Jump to content


Photo

Processing a Simple Form - Beginner

php forms

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 dlmagers

dlmagers

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 11 February 2013 - 12:16 PM

Hello, I am trying to teach myself how to process a simple form in php. Here is what I want to do. I have a simple form.html document and I want to have input fields for First Name and Last Name and Gender.

The Gender field I want to be able to send them the right message if they enter 'M' for Male or 'F' for Female I want to be able to say something like 'Welcome 'Mr or Mrs' First Name and Last Name' in an echo statement.

Here is the code I have thus far.
I have this in the body of my welcome.php page

<?php
if($Gender=="M")
echo(" Welcom Mr.=\"Fname"\"Lname"\");
if($Gender=="F")
echo(" Welcome Mrs.=\"Fname"\"Lname"\");
?>		

This is my index.html

this is the code I have with the body

<form action="welcome.php" method="post">
		 <h2><span class="required_notification">* Denotes Required Field</span>			 </h2>			
			
			 <p>First Name:
<input type="text" name="Fname" maxlength="50" placeholder="First Name" required />
			 *
</p>
			 <p> Last Name
<input type="text" name="Lname" maxlength="75" placeholder="Last Name" required />
			
			 *<br>
			 <br>
			 Sex (Enter 'M' for Male or 'F' for Female):
			 <input type="text" name="Gender" maxlength="1" placeholder="'M' or 'F'" required />
			 *
			 </p>
			 <p>&nbsp;</p>
			 <input type="submit" name="formSubmit" value="Submit" />
			

</form>

Nevertheless, it is not working. Please keep in mind I just started on this and I am not sure if Iknow what I doing. Well, then it is apparent I don't know what I am doing. Could someone please help me and point me in the right direction? Thank you in advance.




Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com