The Master Posted July 20, 2010 Share Posted July 20, 2010 Hi I have previous html experience but I'm fairly new to php. I am trying to create a web form using php which requires me to create a way to show a different kinds of subforms based on user input from a drop down box. For example in my code below, if the user selects "Conference/Meeting" a separate form opens up that has its own text boxes for input. I figured I need an If-then statement (like in traditional programming) but I can't seem to find out how to do this in php. Here is the code I have so far html file <html> <body> <h3>General</h3> <form action="submit.php" method="post"> Employee Requesting :<input type="text" name="employee" /> <br /> Reason: <select name="Reason"> <option value="select">Select</option> <option value="conference">Conference/Meeting</option> <option value="loaner">Loaner</option> </select> <br /> <input type="submit" /> </form> </body> </html> --------------------------------------------------- and the php "submit.php" <html> <body> Employee Requesting: <?php echo $_POST["employee"]; ?>!<br /> </body> </html> ----------------------------------------- Any help would be appreciated, thanks Quote Link to comment https://forums.phpfreaks.com/topic/208336-if-statement-calling-a-form/ Share on other sites More sharing options...
waynew Posted July 20, 2010 Share Posted July 20, 2010 You will need to use JavaScript to solve this problem. If you're wanting the form to change based on what the user chooses from a drop down menu (or something else etc), then you'll need to look into JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/208336-if-statement-calling-a-form/#findComment-1088804 Share on other sites More sharing options...
The Master Posted July 21, 2010 Author Share Posted July 21, 2010 Do you know any specific way to approach this in javascript? or should I move on to a different javascript specific forum lol thanks Quote Link to comment https://forums.phpfreaks.com/topic/208336-if-statement-calling-a-form/#findComment-1089131 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.