Jump to content

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

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.