cab Posted September 5, 2006 Share Posted September 5, 2006 I am very new to PHP (self learning) and I am having a problem with a form I am setting up to collect customers information to opt in for a newletter. I can record all data to my database except an email address. I have not put any restrictions on my data types yet since i was just testing this out. I can save "words" to the "email" column of my database but if i do a formal email address with both the (at) and the (dot com) it gives me a "403 forbidden error" "Server configuration does not allow access to this page."I contacted my web hosting company and asked them if there was an error on their end and they said it had to be in my code (attached below). Please let me know if there is any reason why I could save (cbauer22@gmail.c but i can not save cbauer22@gmail.com) to a mysql database.Thanks$labels = array( "first_name"=>"First Name:","last_name"=>"Last Name:","email"=>"Email Address:","address1"=>"Street Address Line 1:","address2"=>"Street Address Line 2:","city"=>"City:","state"=>"State:","zip"=>"Zip Code:","phone"=>"Phone Number:");echo "<p align='center'><b>Please enter your information below.</b><hr>";echo "<form action='saveaddress.php' method='POST'><table width='95%' border='0' cellspacing='0'cellpadding='2'>\n";foreach($labels as $field=>$label){echo "<tr><td align='right'> <B>{$labels[$field]} </br></td><td><input type='text' name='$field' size='65'maxlength='65' ></td></tr>";}echo "</table><div align='center'><input type='submit' value='Submit Information'> </div></form>"; Quote Link to comment https://forums.phpfreaks.com/topic/19800-trouble-saving-email-address-in-a-form/ Share on other sites More sharing options...
ober Posted September 5, 2006 Share Posted September 5, 2006 Can you show us the code where you're actually using the INSERT statement? Quote Link to comment https://forums.phpfreaks.com/topic/19800-trouble-saving-email-address-in-a-form/#findComment-86606 Share on other sites More sharing options...
cab Posted September 5, 2006 Author Share Posted September 5, 2006 Like i said i'm new at this, so i hope this is the code you were refering to...... $connection = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection) or die ("Couldn't select database"); $query = "INSERT INTO customer (first_name,last_name,email,address1,address2,city,state,zip,phone) VALUES ('$first_name','$last_name','$email','$address1','$address2','$city','$state','$zip','$phone')"; $result = mysql_query($query) or die ("Couldn't execute query."); echo "Thank You Quote Link to comment https://forums.phpfreaks.com/topic/19800-trouble-saving-email-address-in-a-form/#findComment-86609 Share on other sites More sharing options...
ober Posted September 5, 2006 Share Posted September 5, 2006 And I assume that is in a file called "saveaddress.php"? That code looks fine except for the fact that all your variables in the VALUES part should be '$_REQUEST['first_name']'... etc. You can't access the variables directly like that on another page. Quote Link to comment https://forums.phpfreaks.com/topic/19800-trouble-saving-email-address-in-a-form/#findComment-86612 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.