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!
Hi i am a little stuck on the following code, what I am trying to do is if the vale of the two drop down boxes is == then open a specific page in the following window.
<form action ="test">
// Two drop down fields in here
<input type="submit" value="Build Letter">
<input type="reset" value="Reset form">
<?PHP
<form action ="<?$_SERVER['PHP_SELF']?>">
// Two drop down fields in here
<input type="submit" value="Build Letter">
<input type="reset" value="Reset form">
#assuming you have to drop down fields with name="country" and name="to"
if (isset($_POST['submit']))
{
test ($_POST['country'],$_POST['to']);
function test($country,$to)
if ($country != "Australia") && ($to == "Bob")
form action ="listing91.php"
elseif ($country != "Australia") && ($to == "Jim")
form action ="listing92.php"
elseif ($country == "Australia") && ($to == "Peter")
form action ="listing93.php"
else
Print "Sorry someone has made an error";
}
?>
zeroanarchy, I'm not quite sure what you're trying to do here. Are you wishing to dynamically control the action or a form from within the same page via the drop downs, or are the drop downs on the previous page, selected, submitted, and processed into this page?
Thanks all for your help wondering if I could pick your brain a bit further.
ok well I tried that method and found that it came up with further problems the further I got into the code , so I have figured out a work around but I am stuck on something.
I have thre pages
Page 1
Customer enters their name and details
Page 2
Confirms the user name and details
Page 3
shows the users details again.
My problem is how do I make the orginal entry travel as far as the third page. I can make it go as far as page 2 but can not figure out how to make it travel to page3.
Ok as you can guess I am fairly new at this, I tried the session option and cannot seem to get the value of user to show up on the form, can someone please help?
Thanks everyone for your help, markl999 thanks for your help. I am still have a bit of a problem the session does not seem to be saving
Page 3 keep coming up with "Username not set", so I took the contents that you mentioned to palce in page 3 and instead added them to page2 just to see if the "username" field was working. I had no problems getting the username to print to the screen on page 2 but when I tried it on page 3 I only ever got "Username not set" and Ideas.
<html>
<head>
<title>New Page 2</title>
</head>
<body>
<?PHP
$_SESSIONї'username'] = $user;
if ($user==""){
Print "<b>Hi, our system tells us that you have forgot to enter the information correctly, can you hit the back button and fill in all the required fields!</b>";
} else {
Print "<br>$user<br>";
}
?>
<form action ="sent.php">
<input type="submit" value="Show name">
</body>
</html>