elmas156 Posted August 21, 2008 Share Posted August 21, 2008 I'm fairly new to PHP and, as most, I'm learning as I go. I'm creating a membership system and using some ideas from unidox's tutorial but I'm having some problems. Basically when I upload the following page, it is totally blank when viewed. The idea is that, because the form on the page has not been submitted yet, it should show the form so that the user can fill it out. After the form is completed and submitted it will redirect to the login page of the site. I'm sure there is something wrong with the code but I have no clue where to start because I'm not getting an error message... just a blank white page. Any help would be greatly appreciated. Here is the code: <?php include("conf.inc.php"); // Includes the db and form info. if (!isset($_POST['submit'])) { // If the form has not been submitted. echo "<form action=\"signup.php\" method=\"POST\">"; echo "<div align=\"center\">"; echo "<table width=\"645\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">"; echo "<tr>"; echo "<td width=\"640\" height=\"321\" align=\"center\" valign=\"top\">"; echo "<p align=\"left\"><strong><font color=\"#FFFFFF\" size=\"5\"> Customer Sign-Up...<br>"; echo "</font></strong><font color=\"#FF0000\"> The following information will be used only to contact you regarding your service.</font></p>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">First Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"fname\" type=\"text\" id=\"fname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Last Name:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"lname\" type=\"text\" id=\"lname\" size=\"37\" maxlength=\"25\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"haddress\" type=\"text\" id=\"haddress\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">City, State & Zip:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hcity\" type=\"text\" id=\"hcity\" size=\"18\" maxlength=\"20\">"; echo ","; echo "<select name=\"hstate\" id=\"hstate\">"; echo "<option value=\"AL\">AL</option>"; echo "<option value=\"AK\">AK</option>"; echo "<option value=\"AZ\">AZ</option>"; echo "<option value=\"AR\">AR</option>"; echo "<option value=\"CA\">CA</option>"; echo "<option value=\"CO\">CO</option>"; echo "<option value=\"CT\">CT</option>"; echo "<option value=\"DE\">DE</option>"; echo "<option value=\"DC\">DC</option>"; echo "<option value=\"FL\">FL</option>"; echo "<option value=\"GA\">GA</option>"; echo "<option value=\"HI\">HI</option>"; echo "<option value=\"ID\">ID</option>"; echo "<option value=\"IL\">IL</option>"; echo "<option value=\"IN\">IN</option>"; echo "<option value=\"IA\">IA</option>"; echo "<option value=\"KS\">KS</option>"; echo "<option value=\"KY\">KY</option>"; echo "<option value=\"LA\">LA</option>"; echo "<option value=\"ME\">ME</option>"; echo "<option value=\"MD\">MD</option>"; echo "<option value=\"MA\">MA</option>"; echo "<option value=\"MI\">MI</option>"; echo "<option value=\"MN\">MN</option>"; echo "<option value=\"MS\">MS</option>"; echo "<option value=\"MO\">MO</option>"; echo "<option value=\"MT\">MT</option>"; echo "<option value=\"NE\">NE</option>"; echo "<option value=\"NV\">NV</option>"; echo "<option value=\"NH\">NH</option>"; echo "<option value=\"NJ\">NJ</option>"; echo "<option value=\"NM\">NM</option>"; echo "<option value=\"NY\">NY</option>"; echo "<option value=\"NC\">NC</option>"; echo "<option value=\"ND\">ND</option>"; echo "<option value=\"OH\">OH</option>"; echo "<option value=\"OK\">OK</option>"; echo "<option value=\"OR\">OR</option>"; echo "<option value=\"PA\">PA</option>"; echo "<option value=\"RI\">RI</option>"; echo "<option value=\"SC\">SC</option>"; echo "<option value=\"SD\">SD</option>"; echo "<option value=\"TN\">TN</option>"; echo "<option value=\"TX\" selected>TX</option>"; echo "<option value=\"UT\">UT</option>"; echo "<option value=\"VT\">VT</option>"; echo "<option value=\"VA\">VA</option>"; echo "<option value=\"WA\">WA</option>"; echo "<option value=\"WV\">WV</option>"; echo "<option value=\"WI\">WI</option>"; echo "<option value=\"WY\">WY</option>"; echo "</select>"; echo " <input name=\"hzip\" type=\"text\" id=\"hzip\" size=\"3\" maxlength=\"5\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Home Phone:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"hphone\" type=\"text\" id=\"hphone\" size=\"37\" maxlength=\"14\">"; echo "<font size=\"2\"><br>"; echo "<font color=\"#999999\">Include area code (i.e. 940-555-1234)</font></font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Email Address:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"email\" type=\"text\" id=\"email\" size=\"37\" maxlength=\"40\">"; echo "<br>"; echo "<font color=\"#999999\" size=\"2\">(Your email will also be your user ID.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Choose a Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword\" type=\"password\" id=\"pword\" size=\"37\" maxlength=\"20\">"; echo "<br>"; echo "<font color=\"#999999\"size=\"2\">(Minimum of 6 characters in length.)</font></td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Re-enter Password:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"pword2\" type=\"password\" id=\"pword2\" size=\"37\" maxlength=\"20\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"24\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Security Question:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<select name=\"question\" id=\"question\">"; echo "<option value=\"0\" selected>--Choose a security question--</option>"; echo "<option value=\"What was your high school mascot?\">What was your high school mascot?</option>"; echo "<option value=\"What is your mother's maiden name?\">What is your mother's maiden name?</option>"; echo "<option value=\"What was your first car?\">What was your first car?</option>"; echo "<option value=\"Who was your favorite teacher?\">Who was your favorite teacher?</option>"; echo "<option value=\"What is your library card number?\">What is your library card number?</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"187\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Answer:</font></strong></td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<input name=\"answer\" type=\"text\" id=\"answer\" size=\"37\" maxlength=\"35\">"; echo "</td>"; echo "</tr>"; echo "</table><br>"; echo "<table width=\"625\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td width=\"187\" height=\"102\" align=\"left\" valign=\"top\"><strong><font color=\"#FFFFFF\">Terms of Service:</font></strong></td>"; echo "<td width=\"438\" align=\"right\" valign=\"top\">"; echo "<textarea cols=\"40\" rows=\"5\" readonly=\"readonly\" wrap=\"VIRTUAL\" style=\"width:100%;text-align:\" onfocus=\"this.rows=10\">"; echo "Terms of Service text goes here."/ echo "</textarea>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\"><font color=\"#FFFFFF\">"; echo "By clicking 'I accept' below, you are agreeing to the Terms of Service and the Alleyway Oil & Lube Service Agreement.</font></td>"; echo "</tr>"; echo "</table>"; echo "<table width=\"625\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td> </td>"; echo "<td width=\"438\" align=\"left\" valign=\"top\">"; echo "<div align=\"left\">"; echo "<input name=\"Submit\" type=\"submit\" id=\"Submit\" value=\"I accept, continue to my account.\" onClick=\"return validate(form)\">"; echo "</div></td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</form>"; } else { // The form has been submitted. $fname = form($_POST['fname']); $lname = form($_POST['lname']); $haddress = form($_POST['haddress']); $hcity = form($_POST['hcity']); $hstate = form($_POST['hstate']); $hzip = form($_POST['hzip']); $hphone = form($_POST['hphone']); $email = form($_POST['email']); $pword = md5($_POST['pword']); // Encrypts the password. $question = form($_POST['question']); $answer = form($_POST['answer']); $q = mysql_query("SELECT * FROM `users` WHERE email = '$email'") or die (mysql_error()); // mySQL Query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r > 0) { // If there are users with the same email. exit("That email is already registered!"); } else { mysql_query("INSERT INTO `users` (fname,lname,haddress,hcity,hstate,hzip,hphone,email,pword,question,answer) VALUES ('$fname','$lname','$haddress','$hcity','$hstate','$hzip','$hphone','$email','$pword','$question','$answer')") or die (mysql_error()); // Inserts the user info. header("Location: login.php"); // Back to login. } } mysql_close($db_connect); // Closes the connection. ?> Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/ Share on other sites More sharing options...
revraz Posted August 21, 2008 Share Posted August 21, 2008 Turn display errors on Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622347 Share on other sites More sharing options...
Barand Posted August 21, 2008 Share Posted August 21, 2008 For example, line 161 has "/" instead of ";" echo "Terms of Service text goes here."/ Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622356 Share on other sites More sharing options...
elmas156 Posted August 21, 2008 Author Share Posted August 21, 2008 Turn display errors on how do I turn display errors on? Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622359 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 <?php error_reporting(E_ALL); ?> Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622365 Share on other sites More sharing options...
Barand Posted August 21, 2008 Share Posted August 21, 2008 That will ensure all errors are reported if errors are being displayed in the first place. It needs to be turned ON in the php.ini file Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622369 Share on other sites More sharing options...
elmas156 Posted August 21, 2008 Author Share Posted August 21, 2008 so it's something that would have to be done at the server rather than my browser... oh well, Barand, your suggestion did it. that was the only thing that was wrong. Thanks! Link to comment https://forums.phpfreaks.com/topic/120751-solved-help-with-code/#findComment-622421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.