Checkbox Processing Question #2

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
drputo
Forum Newbie
Posts: 3
Joined: Fri Jul 08, 2005 7:36 pm

Checkbox Processing Question #2

Post by drputo »

Ok, I am working on a mock order form.
http://www.magicbean.ca/pizza.html

I will try to make this as clear as possible.

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Putohree checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Putoe a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the valu 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$priue of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't wo

I will try to make this as clear as possible.

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

&lt;?
echo $size;
$price = 8.99;
if(isset($small)){echo &n a mock order form.
[url]http://www.magicbean.ca/pizza.html[/url]

I will try to make this as clear as possible.

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Putot I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

&lt;?
echo $size;
$price = 8.99;
if(isset($small)){echo &quote;$price&quoteer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

&lt;?
echo $size;
$price = 8.99;
if(isset($small)){echo &quote;$price&quote;;} 
else{ echo &quote; Variable does not exists &quot

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Varihat I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

&lt;?
echo $size;
$price = 8.99;
if(isset($small)){echo &quote;$price&quote;;} 
else{ echo &quote; Variable does not exists &quote;;}
?&gt;
it doesn't work. But when I replaand the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Putoey want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Puto as clear as possible.

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not existean.ca/pizza.html[/url]

I will try to make this as clear as possible.

What I am trying to do is have a page process the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it doesocess the size of pizza and what toppings the customer would like and have the total on the page ready for the customer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name mer to submit.

As you can see on the page there's 3 radio buttons in one group and three checkboxes.

The radio buttons name are "size" and the value of each one is "small", "medium", and "large".

What I'm trying to do now is when someone submits what size they want it will show up in the confirm.php page as "small" and "$8.99"

Now when I use this code on the confirm.php page

Code: Select all

<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";} 
else{ echo " Variable does not exists ";}
?>
it doesn't work. But when I replace the $small with $size it does work.

What give
<?
echo $size;
$price = 8.99;
if(isset($small)){echo "$price";}
else{ echo " Variable does not exists ";}
?>


it doesn't work. But when I replace the $small with $size it does work.

What gives? Does the isset function need the name rather than the value only?

Thank You,

Dr. Puto
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

the name of the variable is size and it's values could either be small medium or large.

you shouldn't be checking to see if "small" is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times.er practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times. the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring o posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo)){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a differene.

you shouldn't be checking to see if "small" is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST&#1111;'size'])){
  switch($_POST&#1111;'size']){
    case &quote;small&quote;:
    $price = &quote;8.99&quote;;
    break;
    case &quote;medium&quote;:
    $price = &quote;10.99&quote;;
    break;
    case &qriable is size and it's values could either be small medium or large.

you shouldn't be checking to see if "small" is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times. as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small&quote;:
    $price = &quote;8.99&quote;;
    break;
    case &quote;medium&quote;:
    $price = &quote;10.99&quote;;
    break;
    case &quote;large&quote;:" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST&#1111;'size'])){
  switch($_POST&#1111;'size']){
    case &quote;small&quote;:
    $price = &quote;8.99&quote;;
    break;
    case &quote;medium&quote;:
    $price = &quote;10.99&quote;;
    break;
    case &quote;large&quote;:
    $price = &quote;12.99&quote;;
    break;
  } // is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a swiet as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there 111;'size'])){
switch($_POST['size']){
case "small":
$price = "8.99";
break;
case "medium":
$price = "10.99";
break;
case "large":
$price = "12.99";
break;
} // end switch
echo $price;


I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times.;;
break;
case "medium":
$price = "10.99";
break;
case "large":
$price = "12.99";
break;
} // end switch
echo $price;


I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times.king to see if "small" is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there whicbe small medium or large.

you shouldn't be checking to see if "small" is set as that's not the name of the variable...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same varle...rather if you want to see if the value of "size" is "small" then use an if block to make that determination.

also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it wh
also always use the $_POST[] array when referring to posted variables...it's much better practice.

Code: Select all

if(isset($_POST['size'])){
  switch($_POST['size']){
    case "small":
    $price = "8.99";
    break;
    case "medium":
    $price = "10.99";
    break;
    case "large":
    $price = "12.99";
    break;
  } // end switch
echo $price;
I used a switch case there which is basically the same thing as if / elseif / else, just a different way of doing it when you're comapring the same variable mulitple times.
Post Reply