studentofstone Posted December 29, 2010 Share Posted December 29, 2010 everything seems to be working fine except the form wont show up. the site is here http://davisgutierrez.com/testing_area/form.php <?php if($_POST['formSubmit'] == "Submit") { if(empty($_POST['formName'])) { $errorMessage .= "<li>You forgot to enter your Name.</li>"; } if(empty($_POST['address'])) { $errorMessage .= "<li>You forgot to enter your address.</li>"; } if(empty($_POST['city'])) { $errorMessage .= "<li>You forgot to enter your city.</li>"; } if(empty($_POST['state'])) { $errorMessage .= "<li>You forgot to enter your state.</li>"; } if(empty($_POST['zip'])) { $errorMessage .= "<li>You forgot to enter your zip code.</li>"; } if(empty($_POST['phone'])) { $errorMessage .= "<li>You forgot to enter your phone number.</li>"; } if(empty($_POST['email'])) { $errorMessage .= "<li>You forgot to enter your email.</li>"; } } $varformName = $_POST['formName']; $varaddress = $_POST['address']; $varcity = $_POST['city']; $varstate = $_POST['state']; $varzip = $_POST['zip']; $varphone = $_POST['phone']; $varemail = $_POST['email']; //generated by fatcow $link = mysql_connect(''); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; $db_selected = mysql_select_db("learnphp"); if (!$db_selected) { die(' blast!' . mysql_error()); } if(!empty($errorMessage)) { echo("<p>There was an error with your form:</p>\n"); echo("<ul>" . $errorMessage . "</ul>\n"); } $fs = fopen("memberdata.csv","a"); fwrite($fs,$varformName . ", " . $varAddress . ", " . $varCity . "," . $varState . "," . $varZip . "," . $varPhone . "," . $varEmail . "," . "/n"); fclose($fs); //header("Location: thankyou.html"); exit; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <head> <title>membership test</title> </head> <body> <?php if(!empty($errorMessage)) { echo("<p>There was an error with your form:</p>\n"); echo("<ul>" . $errorMessage . "</ul>\n"); } ?> <form action="form.php" method="post" name="ohta_membership_application" > Name: <input type="text" name="formName" maxlenghth="45" value="<?=$varformName;?>" /> Address: <input type="text" name="address" maxlenghth="4" value="<?=$varAddress;?>" /> City: <input type="text" name="city" maxlenghth="4" value="<?=$varCity;?>" /> State: <input type="state" name="state" maxkength="2" value="<?=$varState;?>"> Zip: <input type="text" name="zip" maxlenghth="4" value="<?=$varZip;?>" /> Phone: <input type="text" name="phone" maxlenghth="4" value="<?=$varPhone;?>" /> Email: <input type="text" name="email" maxlenghth="4" value="<?=$varEmail;?>" /> <input type="submit" name="formSubmit" value="Submit" /> <input type="reset" name="reset" value="Reset" > </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/222950-html-wont-show/ Share on other sites More sharing options...
BlueSkyIS Posted December 29, 2010 Share Posted December 29, 2010 the script appears to hit exit; before the HTML is reached. Quote Link to comment https://forums.phpfreaks.com/topic/222950-html-wont-show/#findComment-1152777 Share on other sites More sharing options...
AE117 Posted December 29, 2010 Share Posted December 29, 2010 dont state exit if the database does not connect exit not only stops php but everything from there down. Quote Link to comment https://forums.phpfreaks.com/topic/222950-html-wont-show/#findComment-1152784 Share on other sites More sharing options...
BlueSkyIS Posted December 29, 2010 Share Posted December 29, 2010 if you want the database to connect but it doesn't, you certainly want to exit. there is a better solution. Quote Link to comment https://forums.phpfreaks.com/topic/222950-html-wont-show/#findComment-1152786 Share on other sites More sharing options...
studentofstone Posted January 4, 2011 Author Share Posted January 4, 2011 ok, now it gives me mail sent but the email isn't getting there. I am using eclipse and have error reporting on at the server. there are no error messages. that means I am either telling the program to do something wrong, or not telling it to do something i need it to do. mail("$email", "$subject", "$message", "$headers", "From: $from"); $mail_sent = @mail("$email", "$subject", "$message", "$headers", "From: $from"); echo $mail_sent ? "Mail sent" : "Mail failed"; Quote Link to comment https://forums.phpfreaks.com/topic/222950-html-wont-show/#findComment-1154808 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.