weetabix Posted December 13, 2007 Share Posted December 13, 2007 Ok, I have a form where the user will enter their ID and I want to forward this to another page where it will be checked if it's valid and display the appropriate information. I created the following form <form action="staffMenu" method="get"> <table width="42%"> <tr> <td width="43%">Please enter staff ID</td> <td width="54%"><input type = "Text" name="staffid"></td> </tr> <tr> <td colspan="2"><input type= "Submit" name="submit" value= "Submit"></td> </tr> </table> Which I think is correct, not sure though However, how am I going to refer to it from the other PHP file ? What I've been told is that it should be something like this: if(!isset($_GET['staffid'])) { echo "<p><strong>Error:</strong> Cannot determine staff ID.</p>\n"; die(); } Any help is appreciated. Quote Link to comment Share on other sites More sharing options...
marcus Posted December 13, 2007 Share Posted December 13, 2007 Correct. According to your form once you submit it, your URL will look something like this: http://website.tld/staffMenu?staffid=x&submit=Submit Using the $_GET method, you will define the two variables as: $staffid = $_GET['staffid']; $submit = $_GET['submit']; If you want to use this for continuous use you're going to want to use sessions or cookies to pass the data throughout any other pages that you wouldn't want the user having to type the Staff ID again. Quote Link to comment Share on other sites More sharing options...
weetabix Posted December 13, 2007 Author Share Posted December 13, 2007 No, I only want to forward the information to the next page, so this should do so if I use the isset command after I submit the information that's going to check if the staff id is set and if not it'll kill the connection. right ? Quote Link to comment Share on other sites More sharing options...
marcus Posted December 13, 2007 Share Posted December 13, 2007 if(isset($staffid)){ echo "Staff ID is set"; }else { echo "Staff ID was not provided!"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.