LuciBKen Posted May 16, 2007 Share Posted May 16, 2007 Hi, look I'll just admit it, I'm a rookie, and I can't get this script to work. I think it has somthing to do with the form method line, or something, anyways I have to have this up this afternoon and I need some help from someone who has some patience. The code is pasted below and what is supposed to do is take an email address from a field, validate it, send a reply and then submit it to a database. Please, can someone help? [code]<html><head><title>Email Submission Page</title></head> <body> <form method="post" action=testemailscript.php> Please enter a valid email address <input type="text" name="email" value=""> <input type="submit" name="submit" value="submit" </form> <? @$email = addslashes($_POST['email']); // Validation if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { die("<p align='center'><font face='Arial' size='3' color='#FFFFFF'>That email address is invalid</font></p>"); } if (strlen($email) == 0 ) { die("<p align=\"center\"><font face=\"Vrinda\" size=\"4\"color=\"#FFFFFF\">Please enter your email address</font></p>"); } $pfw_header = "From: **************"; $pfw_subject = "Comfirmation"; $pfw_email_to = "$email"; $pfw_message = "Email Confirmation"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; $dbhost = 'localhost:3306'; $dbuser = 'root'; $dbpass = '*********'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'testemail'; mysql_select_db($dbname); $sql = "insert into email (email_address) values('$email')"; mysql_close($conn); ?> </body></html> [/code] Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/ Share on other sites More sharing options...
kenrbnsn Posted May 16, 2007 Share Posted May 16, 2007 What is this code doing or not doing? Are you getting any errors? Ken Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/#findComment-254697 Share on other sites More sharing options...
LuciBKen Posted May 16, 2007 Author Share Posted May 16, 2007 I'm not getting any errors, when i goto the site and submit an email address, I don't get a response and nothing goes to the db, the page is www.contract2print.com/testemailscript.php if you want to see, it just won't work at all for me Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/#findComment-254703 Share on other sites More sharing options...
LuciBKen Posted May 16, 2007 Author Share Posted May 16, 2007 I would like the .php file to contain everything, instead of having to use include if at all possible, but I don't know if that will work? Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/#findComment-254710 Share on other sites More sharing options...
taith Posted May 16, 2007 Share Posted May 16, 2007 well... from the source spashed across your page... it seems like your webhost doesnt support php... Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/#findComment-254715 Share on other sites More sharing options...
chigley Posted May 16, 2007 Share Posted May 16, 2007 Try <?php instead of <? ~ server may have shorthand disabled. Link to comment https://forums.phpfreaks.com/topic/51701-can-somebody-please-help-with-what-should-be-a-simple-script/#findComment-254718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.