1// This file is PHP.
2<html>
3<?php
4 if ($_POST['submit']) {
5 $firstname = $_POST['firstname'];
6 $lastname = $_POST['lastname'];
7 $email = $_POST['email'];
8 $password = $_POST['password'];
9 $confirmpassword = $_POST['confirmpassword'];
10 $strtadd1 = $_POST['strtadd1'];
11 $strtadd2 = $_POST['strtadd2'];
12 $city = $_POST['city'];
13 $country = $_POST['country'];
14 $success = '';
15
16
17 // Upon Success.
18 if ($firstname != '' && $lastname != '' && $email != '' && $password != '' && $confirmpassword != '' && $strtadd1 != '' && $strtadd2 != '' && $city != '' && $country != '') {
19 // Change $success variable from an empty string.
20 $success = 'success';
21
22 // Insert whatever you want to do upon success.
23
24 } else {
25 // Upon Failure.
26 echo '<p class="error">Fill in all fields.</p>';
27
28 // Set $success variable to an empty string.
29 $success = '';
30 }
31 }
32 ?>
33<form method="POST" action="#">
34 <label class="w">Plan :</label>
35 <select autofocus="" name="plan" required="required">
36 <option value="">Select One</option>
37 <option value="FREE Account">FREE Account</option>
38 <option value="Premium Account Monthly">Premium Account Monthly</option>
39 <option value="Premium Account Yearly">Premium Account Yearly</option>
40 </select>
41 <br>
42 <label class="w">First Name :</label><input name="firstname" type="text" placeholder="First Name" required="required" value="<?php if (isset($firstname) && $success == '') {echo $firstname;} ?>"><br>
43 <label class="w">Last Name :</label><input name="lastname" type="text" placeholder="Last Name" required="required" value="<?php if (isset($lastname) && $success == '') {echo $lastname;} ?>"><br>
44 <label class="w">E-mail ID :</label><input name="email" type="email" placeholder="Enter Email" required="required" value="<?php if (isset($email) && $success == '') {echo $email;} ?>"><br>
45 <label class="w">Password :</label><input name="password" type="password" placeholder="********" required="required" value="<?php if (isset($password) && $success == '') {echo $password;} ?>"><br>
46 <label class="w">Re-Enter Password :</label><input name="confirmpassword" type="password" placeholder="********" required="required" value="<?php if (isset($confirmpassword) && $success == '') {echo $confirmpassword;} ?>"><br>
47 <label class="w">Street Address 1 :</label><input name="strtadd1" type="text" placeholder="street address first" required="required" value="<?php if (isset($strtadd1) && $success == '') {echo $strtadd1;} ?>"><br>
48 <label class="w">Street Address 2 :</label><input name="strtadd2" type="text" placeholder="street address second" value="<?php if (isset($strtadd2) && $success == '') {echo $strtadd2;} ?>"><br>
49 <label class="w">City :</label><input name="city" type="text" placeholder="City" required="required" value="<?php if (isset($city) && $success == '') {echo $city;} ?>"><br>
50 <label class="w">Country :</label><select autofocus="" id="a1_txtBox1" name="country" required="required" placeholder="select one" value="<?php if (isset($country) && $success == '') {echo $country;} ?>">
51 <input type="submit" name="submit">
52</form>
53</html>