Jump to content

If statement Calling a form


The Master

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/208336-if-statement-calling-a-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.