Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Sign Up Form Example</title>
	<link rel="stylesheet" type="text/css" href="css/bootstap.min.css">
	<style>
	 div 
      label 
      	{
       	 display: inline-block;
        width: 150px;
      	}
 	</style>
</head>
<body>

<div>
	<?php
		if(isset($_POST['create']))
		{
			echo 'User Submitted';
		}
	?>
</div>

<div>
	<form action="registration.php" method="post">
		<div class="container">

			<h1>Sign Up Form Example</h1>
   		    
			<label for="Firstname"> First, Last Name*:</h></label>
			<input type="text" size="20" maxlength="50" name="First" required>
			<input type="text" size="20" maxlength="50" name="Last Name" required>

			<br><br>
			<label for="Organization">Organization:</h></label>
			<input type="text" size="42" maxlength="50" name="Organization">

			<br><br>
			<label for="Email Address">Email Address*:</h></label>
			<input type="Email Address" size="42" maxlength="50" name="Email Address" required>

			<br><br>
			<label for="Work Phone">Work Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Work Phone">

			<br><br>
			<label for="Home Phone">Home Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Home Phone">

			<br><br>
			<label for="Cell Phone">Cell Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Cell Phone">

			<br><br>
			<label for="Fax">Fax:</h></label>
			<input type="text" size="30" maxlength="50" name="Fax">

			<br><br>
			<label for="Address1">Address1*:</h></label>
			<input type="text" size="50" maxlength="50"name="Address1" required>

			<br><br>
			<label for="Address2">Address2:</h></label>
			<input type="text" size="50" maxlength="50"name="Address2">

			<br><br>
			<label for="City">City*:</h></label>
			<input type="text" size="42" maxlength="50" name="City" required>

			<br><br>
			<label for="State/Province">State/Province:</h></label>
			<input type="text" size="42" maxlength="50"name="State/Province">

			<br><br>
			<label for="Zip/Postal Code">Zip/Postal Code:</h></label>
			<input type="text" size="10" maxlength="50" name="Zip/Postal Code">

			<br><br>
			<label for="Country">Country*:</h></label>
			<input type="text" size="42" maxlength="50"name="Country" required>

			<br><br>
			<label for="required">* - required fields</h></label>
			<input type="submit" name="submit" value="Submit">
		</div>
	</form>
</div>
</body>
</html>


What I have tried:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Sign Up Form Example</title>
	<link rel="stylesheet" type="text/css" href="css/bootstap.min.css">
	<style>
	 div 
      label 
      	{
       	 display: inline-block;
        width: 150px;
      	}
 	</style>
</head>
<body>

<div>
	<?php
		if(isset($_POST['create']))
		{
			echo 'User Submitted';
		}
	?>
</div>

<div>
	<form action="registration.php" method="post">
		<div class="container">

			<h1>Sign Up Form Example</h1>
   		    
			<label for="Firstname"> First, Last Name*:</h></label>
			<input type="text" size="20" maxlength="50" name="First" required>
			<input type="text" size="20" maxlength="50" name="Last Name" required>

			<br><br>
			<label for="Organization">Organization:</h></label>
			<input type="text" size="42" maxlength="50" name="Organization">

			<br><br>
			<label for="Email Address">Email Address*:</h></label>
			<input type="Email Address" size="42" maxlength="50" name="Email Address" required>

			<br><br>
			<label for="Work Phone">Work Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Work Phone">

			<br><br>
			<label for="Home Phone">Home Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Home Phone">

			<br><br>
			<label for="Cell Phone">Cell Phone:</h></label>
			<input type="text" size="30" maxlength="50" name="Cell Phone">

			<br><br>
			<label for="Fax">Fax:</h></label>
			<input type="text" size="30" maxlength="50" name="Fax">

			<br><br>
			<label for="Address1">Address1*:</h></label>
			<input type="text" size="50" maxlength="50"name="Address1" required>

			<br><br>
			<label for="Address2">Address2:</h></label>
			<input type="text" size="50" maxlength="50"name="Address2">

			<br><br>
			<label for="City">City*:</h></label>
			<input type="text" size="42" maxlength="50" name="City" required>

			<br><br>
			<label for="State/Province">State/Province:</h></label>
			<input type="text" size="42" maxlength="50"name="State/Province">

			<br><br>
			<label for="Zip/Postal Code">Zip/Postal Code:</h></label>
			<input type="text" size="10" maxlength="50" name="Zip/Postal Code">

			<br><br>
			<label for="Country">Country*:</h></label>
			<input type="text" size="42" maxlength="50"name="Country" required>

			<br><br>
			<label for="required">* - required fields</h></label>
			<input type="submit" name="submit" value="Submit">
		</div>
	</form>
</div>
</body>
</html>
Posted
Updated 25-Dec-22 19:07pm
Comments
Chris Copeland 22-Oct-21 4:49am    
What do you mean "display the result of this code"? This is the code for a PHP file so you'd need to run it through a PHP webserver, such as XAMPP

1 solution

should be used with input[id=item] not input[name=item]

to get result of code, add in registration.php

var_dump($_POST); // dd($_POST);

or

echo '
';
print_r($_POST);
echo '
';
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900