Jump to content


Photo

*SOLVED* PHP Calculator


  • Please log in to reply
2 replies to this topic

#1 sigmon

sigmon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 April 2006 - 01:48 AM

Hi,

I have a calculator on my site that adds up depending on the data passed over from the previous page

I have just installed a new email script as other one went up the shoot so I have had to change from

<?php echo $_POST["email"]; ?>

to

<?php print "$email";?>

If i use the old version the data doesnt show, the calculator I'm using is

<?php
$_POST['Adults'] = '2';
$start = 80;
$end = 0;
unset($end);
if("$kids" == '4'){
$end = $start + 17;
}else{
$end = $start + 0;
}
if($_POST['wintersports'] == '7'){
$end = $end + 25;
}elseif($_POST['wintersports'] == '14'){
$end = $end + 45;
}else{
$end = $end + 0;
}
if($_POST['Age'] == '18-70'){
$end = $end + 0;
}elseif($_POST['Age'] == '71+'){
$end = $end + 85;
}else{
$end = $end + 0;
}
if(!isset($end)){
$end = $start;
}
echo '£'.$end;
?>

How can i make the calculator work again ???

Many thanks

Sigmon

#2 djnrempel

djnrempel
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 April 2006 - 04:00 AM

I would guess that the new script is sending variables via GET instead of POST.

Try altering the other variables the same way, eg. removing the $_POST['variable'] and just expressing them as $variable. Alternately, try substituting the $_POST with either $_GET, or $_REQUEST (which will catch both GET and POST data).

The first option should work, since the fact that $email works the same as $_POST['email'] suggests that register_globals is enabled.

#3 sigmon

sigmon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 April 2006 - 09:56 AM

YOU ARE AWESOME

$Adults - worked :)

TAHNKS Sigmon




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users