3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php include("connect.php"); include("functions.php"); // define variables and set to empty values $nameErr = $sexErr = $designationErr = $departmentErr = $instituteErr = $staeErr = $countryErr = $mobilenoErr = $officenoErr = $residencenoErr = $email = ""; $name = $sex = $designation = $department = $institute = $state = $country = $mobileno = $officeno = $residenceno = $email = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); } if (empty($_POST["sex"])) { $genderErr = "Gender is required"; }else { $gender = test_input($_POST["sex"]); } } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["designation"])) { $designationErr = "required"; }else { $designation = test_input($_POST["designation"]); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["department"])) { $departmentErr = "required"; }else { $department = test_input($_POST["department"]); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["institute"])) { $instituteeErr = "required"; }else { $institute = test_input($_POST["institute"]); } if (empty($_POST["city"])) { $city = ""; }else { $city = test_input($_POST["city"]); } if (empty($_POST["state"])) { $stateErr = "required"; }else { $state = test_input($_POST["state"]); } if (empty($_POST["country"])) { $countryErr = "required"; }else { $country = test_input($_POST["country"]); } if (empty($_POST["pincode"])) { $pincode = ""; }else { $pincode = test_input($_POST["pincode"]); } if (empty($_POST["OfficeNo"])) { $OfficeNo = ""; }else { $OfficeNo = test_input($_POST["officeNo"]); } if (empty($_POST["residenceNo"])) { $residenceNo = ""; }else { $residenceNo = test_input($_POST["ResidenceNo"]); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["MobileNo"])) { $MobileNoErr = "required"; }else { $MobileNo = test_input($_POST["MobileNo"]); } if (empty($_POST["email"])) { $emailErr = "Email is required"; }else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } $insertQuery = "INSERT INTO Personal_info(userName, sex, designation, department, institute, city, state, country, pin_code, office_no., residence_no., mobile_no., email_id.) VALUES ('$name', '$sex', '$designation', '$department', '$institute','$city', '$state', '$country', '$pincode', '$officeno', '$residenceno', '$mobileno', '$email')"; if(mysqli_query($con, $insertQuery)) { echo "New record created successfully"; } else { echo "not register"; } } } } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <!doctype html> <html> <head> <title>Registration Form</title> </head> <body bgcolor="#FFFFFF"> <form name="name" action="" onsubmit="return validate_form();" method="post"> <table align="center" width=40% width="100%" cellspacing="2" cellpadding="2" border="5"> <tr> <td colspan="7" align="center"><b>Employee Registration Form.</b></td> </tr> <tr> <td align="left" valign="top" width="30%">Name<span style="color:red">*</span></td> <td width="57%"><select name="mydropdown"> <option value="Default">Default</option> <option value="Professor">Professor</option> <option value="Doctor">Doctor</option> <option value="Mr">Mr</option> <option value="Miss">Miss</option> <option value="Mrs">Mrs</option> </select> <td width="57%"><input type="text" value="" name="name" size="30"></td> </tr></td> <tr> <td align="left" valign="top" width="41%">Sex<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="sex" onkeypress="return isNumberKey(event)" size="24"></td> </tr> <tr> <td align="left" valign="top" width="41%">Designation<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="designation" onkeypress="return isNumberKey(event)" size="24"></td> </tr> <tr> <td align="left" valign="top" width="41%">Department<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="department" onkeypress="return isNumberKey(event)" size="24"></td> </tr> <tr> <td align="left" valign="top" width="41%">Institute<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="institute" onkeypress="return isNumberKey(event)" size="24"></td> </tr> <!--<tr> <td align="left" valign="top" width="41%">Employee Number<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="num" onkeypress="return isNumberKey(event)" size="24"></td> </tr>--> <tr> <td align="left" valign="top" width="41%">City</td> <td width="57%"><textarea rows="1" maxlen="100" name="city" cols="20"></textarea></td> <td align="left" valign="top" width="41%">State</td> <td width="57%"><textarea rows="1" maxlen="100" name="state" cols="20"></textarea></td> <tr> <td align="left" valign="top" width="41%">Country</td> <td width="57%"><textarea rows="1" maxlen="100" name="country" cols="20"></textarea></td> <td align="left" valign="top" width="41%">Pincode</td> <td width="57%"><textarea rows="1" maxlen="100" name="pincode" cols="20"></textarea></td> </tr> </tr> <tr> <td align="left" valign="top" width="41%">OfficeNo.</td> <td width="57%"> <input type="text" value="" onkeypress="return isNumberKey(event)" name="officeno" size="24"></td> <td align="left" valign="top" width="41%">ResidenceNo.</td> <td width="57%"> <input type="text" value="" onkeypress="return isNumberKey(event)" name="residenceno" size="24"></td> </tr> <tr> <td align="left" valign="top" width="41%">MobileNo.</td> <td width="57%"> <input type="text" value="" onkeypress="return isNumberKey(event)" name="mobileno" size="24"></td> </tr> <!--<td align="left" valign="top" width="41%">Designation:</td> <td width="57%"> <input type="text" value="" onkeypress="return isNumberKey(event)" name="txtFName1" size="24"></td> </tr> <tr> <td align="left" valign="top" width="41%">Job Location</td> <td width="57%"><select name="mydropdown"> <option value="Default">Default</option> <option value="Chennai">Chennai</option> <option value="Bangalore">Bangalore</option> <option value="Chennai">Pune</option> <option value="Bangalore">Mysore</option> <option value="Chennai">Chandigarh</option> </select></td> </tr> <tr> <td align="left" valign="top" width="41%">Designation</td> <td width="57%"> <select name="mydropdown"> <option value="Default">Default</option> <option value="Systems Engineer">Systems Engineer</option> <option value="Senior Systems Engineer">Senior Systems Engineer</option> <option value="Technology Analyst">Technology Analyst</option> <option value="Technology Lead">Technology Lead</option> <option value="Project Manager">Project Manager</option> </select></td> </tr>--> <tr> <td align="left" valign="top" width="41%">email<span style="color:red">*</span></td> <td width="57%"> <input type="text" value="" name="email" size="24"></td> </tr> <tr> <td colspan="2"> <p align="center"> <input type="submit" value=" Submit" name="B4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value=" Reset All " name="B5"></td> <a href="step2.php" style="float:right; padding:10px; margin-right:40px; background-color:#eee; color:#333; text-decoration:none;">Next</a> </tr> </table> </form> </body> </html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected '<', expecting end of file in /in/aCTMY on line 3
Process exited with code 255.

preferences:
180.2 ms | 1395 KiB | 36 Q