View Full Version : Need some help.
01-28-2007, 03:25 PM
In a nutshell I am brand spanking new to this language. I have designed a few websites and I am fairly good at it. I have always managed to find a way around using PHP, java, and stuff like that. I have a site that uses PHP but I had nothing to do with the code and had a heck of a time installing it. Anywasys bottom line is I am wet, errr soaked behind the ears when it come to PHP and other scripts and I want to learn now. I am actually reading PHP for Dummies, and will continue on from there. Anyhow the next site I am building requires a script that works similar to this site, the function I am interested in is the use of the radial buttons and the way it tallies the price.
I found Dynamic Drive in the source code. ;)
Anyways if anyone can tell me what this code is, and/or, if I need to finish reading another 27 PHP books before actually being capable of using it, I would appreciate it.
A group of radio buttons with the same name are available in your PHP script as an array. If you don't understand how to access form data yet, or what an array is, then aye, you've got a way to go before doing that. ;)
01-28-2007, 06:12 PM
LOL gotcha...back to the books...
01-28-2007, 06:15 PM
the function I am interested in is the use of the radial buttons and the way it tallies the price
Well for starters, with PHP forms like this you always have to do the HTML end of things first:
<form action="submit.php" method="post">
<input type="checkbox" name="checkbox1" value="15">
<input type="checkbox" name="checkbox2" value="45">
submit.php - processes the information
$field1 = $_POST["checkbox1"];
$field2 = $_POST["checkbox2"];
$output = $field1 + $field2;
Let's break down the above script:
first line: "$" always starts before defining a variable, which in this case it's contents is checkbox1's value.
Line two is the same except your defining the second checkbox.
Line four processes the information, adding $field1 and $field2.
Line five is a simple statement "echo" which writes the variable $output.
The outcome should be "60"
That should point you in some direction.
01-28-2007, 06:16 PM
Oops, sorry Twey. We cross-posted.
01-28-2007, 08:45 PM
Thanks but I now know I need to do some reading before I ask to many more questions because I am just wasting your time if I don't understand your answer. At least this is here for when I do understand.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.