mwq27 Posted November 2, 2006 Share Posted November 2, 2006 Whenever I hit submit from the HTML form, I get a blank screen on the php page. There is something wrong with my code and I just cant figure it out. Here is the code [code]<?phpecho 'HWHEEADONASOIOAIDHOIAD';$host = 'localhost';$user = 'root';$pass = 'xxxxx';$dbname = 'pecs';$link = mysql_connect($host, $user, $pass);if(!$link){ die("Could not connect: " .mysql_error()); }mysql_select_db($dbname, $link) or die (" Database not found." . mysql_error());$email = $_POST['email'];$name = $_POST['name'];$title = $_POST['title'];$address = $_POST['address'];$city = $_POST['city'];$state = $_POST['state'];$zip = $_POST['zip'];$phone = $_POST['phone'];$org = $_POST['org'];$regreg = $_POST['regreg'];$stureg = $_POST['stureg'];if(empty($email) || empty($name) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($phone) || empty($org)) { echo 'you didnt fill in all the required fields! go back and do it again...'; // echo "<a href=\"javascript:history.go(-1);\">« back</a>"; } else { // Check to make sure its a valid email, and already exists if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $check_email = "SELECT * FROM regform WHERE email='$email'"; $result = mysql_query($check_email) or die (mysql_error()); if (mysql_num_rows($result) > 0) { $email = FALSE; echo 'That email is already being used!<br />'; } //if a radio button hasnt been selected if(!isset($regreg) && !isset($stureg)) { echo 'Please select whether you student registration or regular registration.'; } else { //set variable to the right radio button if(!isset($regreg)) { $regreg = $_POST['stureg']; } else $regreg = $_POST['regreg']; $sql = mysql_query("insert into regform (name, org, title, address, city, state, zip, phone, email, regbef) values ('$name', '$org', '$title', '$address', '$city', '$state', '$zip', '$phone', '$email', '$regreg')");$result = mysql_query($sql);if(!result) echo 'could not register you try again'; //throw new Exception('Could not register you, try again'); else echo 'Success!!'; }?> [/code]Could someone please tell me what is wrong here. Thanks Link to comment https://forums.phpfreaks.com/topic/25965-registration-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.