Jump to content

*SOLVED* PHP Calculator


sigmon

Recommended Posts

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.