I am creating a registration page, like name, last name, Date of birth, ph number, address etc..
When i click submit button all the values are taking to validation page using POST method.
If any field is blank then script will say fill all the fields, then redirect to the registration page itself,
During this process when redirecting to registration page i should get the existing values which i typed already.
Can any one give me some idea to do so please,
This is validation page code.
Expand|Select|Wrap|Line Numbers
- <?php
- include ("config/config.php");
- $dbtable = "corporates";
- $resultvalue=0;
- $first_name = strip_tags(mysql_real_escape_string($_POST["first_name"]));
- setcookie("first_name",$first_name,time()+3600);
- $middle_name = strip_tags(mysql_real_escape_string($_POST["middle_name"]));
- $last_name = strip_tags(mysql_real_escape_string($_POST["last_name"]));
- $dobdd = strip_tags(mysql_real_escape_string($_POST["dob-dd"]));
- $dobmm =strip_tags(mysql_real_escape_string($_POST["dob-mm"]));
- $dobyyyy = strip_tags(mysql_real_escape_string($_POST["dob-yyyy"]));
- $dob = $dobdd . "-" . $dobmm . "-" . $dobyyyy;
- $bloodgroup = strip_tags(mysql_real_escape_string($_POST["blood-group"]));
- $pmailid = strip_tags(mysql_real_escape_string($_POST["p-mailid"]));
- $pcell = strip_tags(mysql_real_escape_string($_POST["p-cell"]));
- $lno = strip_tags(mysql_real_escape_string($_POST["l-no"]));
- $caddress1 = strip_tags(mysql_real_escape_string($_POST["c-address"]));
- $caddress2 = strip_tags(mysql_real_escape_string($_POST["c-address2"]));
- $caddress3 = strip_tags(mysql_real_escape_string($_POST["c-address3"]));
- $caddress = $c-address1 . "," . $c-address2 . "," . $c-address3 . ".";
- $language = strip_tags(mysql_real_escape_string($_POST["languageknown"]));
- if((strlen($first_name)==0)||(strlen($middle_name)==0)||(strlen($last_name)==0)||(strlen($dob-dd)==0)||(strlen($dobmm)==0)||(strlen($dobyyyy)==0)||(strlen($dob)==0)||(strlen($bloodgroup)==0)||(strlen($pmailid)==0)||(strlen($pcell)==0)||(strlen($lno)==0)||(strlen($caddress1)==0)||(strlen($caddress2)==0)||(strlen($caddress3)==0)||(strlen($caddress)==0)||(strlen($language)==0))
- {
- /**** Setting Cookie values for the field to redirect to the same page ****/
- $first_name = strip_tags(mysql_real_escape_string($_POST["first_name"]));
- setcookie("first_name",$first_name,time()+3600);
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Kindly fill all the erquired Fields</title>
- <script type="text/javascript">
- alert(" Kindly Fill all the required Fields");
- </script>
- </head>
- <body>
- <script>window.location='employee_register.php'</script>
- </body>
- </html>
- <?php
- }
- else
- {
- /* update to database */
- }
- ?>
Regards
magesh