aub Posted April 27, 2014 Share Posted April 27, 2014 For some reason, when I click the button "Submitted", the error came up "Object not found!" but I believe my php still works? <html xmlns='http://www.w3.org/1999/xhtml'> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>Form Page: sampleform</title> </head> <body> <h1>postback.php:postback practice</h1> <?php if (isset($_POST['Submit'])) { echo "inside the form". $_POST['Submit'] . "<br>"; $firstname = $_POST['fname']; $lastname = $_POST['lname']; $DOB = $_POST['dob']; $address = $_POST['add']; $suburb = $_POST['sub']; $state = $_POST['state']; $postcode = $_POST['pcode']; $contactphone = $_POST['phone']; $myemail = $_POST['Email']; $errors = array(); $errors[]=NULL; if (empty($firstname)) { $errors[0] =" First Name Can not be Empty <br> "; } if (empty($lastname)) { $errors[1] =" Last Name Can not be Empty <br> "; } if (empty($DOB)) { $errors[2] =" date only <br> "; } if (empty($address)) { $errors[3] =" Address Can not be Empty <br> "; } if (empty($suburb)) { $errors[4] =" suburb Can not be Empty <br> "; } if (empty($state)) { $errors[5] =" state Can not be Empty <br> "; } if (empty($postcode)) { $errors[6] =" postcode Can not be Empty <br> "; } if (empty($contactphone)) { $errors[7] =" contact phone Can not be Empty <br> "; } if (empty($myemail)) { $errors[8] =" email Can not be Empty <br> "; } echo "<pre>"; var_export($errors); echo "</pre>"; //if (count($errors) > 0) { foreach ($errors as $msg) { echo "<br> $msg"; } /* if (!empty($uname) && !empty($myemail)) { echo "Thank you for your submission, one of our staffs will contact you within 24 hours <br>"; } else echo "Sorry student firstname, student lastname, student dob, streeet address, suburb, state, post code, contact phone and/or email can not be EMPTY, please resubmit <br>"; */ } else { ?> <fieldset> <legend>Personal Details:</legend> <form action="activity6.php", method="post"> <p>Student First Name: <input type="text" name="fname" value=""/></p> <p>Student Last Name: <input type="text" name="lname" value=""/></p> <p>Student DOB: <input type="date" name="dob" value=""/></p> <p>Street Address: <input type="text" name="add" value=""/></p> <p>Suburb: <input type="text" name="sub" value=""/></p> <p>State: <input type="text" name="state" value=""/></p> <p>Post Code: <input type="text" name="pcode" value=""/></p> <p>Contact phone: <input type="text" name="phone" value=""/></p> <p>Email address: <input type="text" name="Email" value=""/></p> <p><input type="submit" name="Submit" value="Submitted"/></p> </fieldset> </form> <?php echo "not in form yet"; echo "<br>" . $_SERVER['PHP_SELF']; } ?> Thanks! EDIT: Forgot to say this; can you let me know if it works or not. Thanks again Link to comment https://forums.phpfreaks.com/topic/288054-can-you-test-this-for-me-please/ Share on other sites More sharing options...
aub Posted April 27, 2014 Author Share Posted April 27, 2014 Never mind, it works now :S Any mod can close this thread. Cheers! <3 Link to comment https://forums.phpfreaks.com/topic/288054-can-you-test-this-for-me-please/#findComment-1477428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.