DimitriDV Posted December 23, 2008 Share Posted December 23, 2008 I can insert records but the email address doesn't show up! $naam = mysql_real_escape_string($_POST['naam']); $voornaam = mysql_real_escape_string($_POST['voornaam']); $email = mysql_real_escape_string($_POST['email']); $query="INSERT INTO ClubLeden (naam, voornaam, email) VALUES ('$naam','$voornaam','$email')"; $result = mysql_query($query, $DBC) or die("Cannot connect: " . mysql_error()); ... <input type="text" name="email" id="email" /> ps: the table has a column called email :-\ after inserting the records, the email address remains empty, no error Quote Link to comment Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Have you tried any debugging at all? I would suggest doing this... echo('Input from form: '.$_POST['email'].' - Email after escape: '.$email); Put that on the line before the query, and tell us what it returns. Happy Xmas! ILMV Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 $naam = mysql_real_escape_string($_POST['naam']); $voornaam = mysql_real_escape_string($_POST['voornaam']); $email = mysql_real_escape_string($_POST['email']); $query="INSERT INTO ClubLeden (naam, voornaam, email) VALUES ('$naam','$voornaam','$email')"; if (!mysql_query($query, $DBC)) { echo $query; } Try that - if the query fails to insert it'll dump the query to the browser so you can see exactly what its attempting to use. Quote Link to comment Share on other sites More sharing options...
DimitriDV Posted December 23, 2008 Author Share Posted December 23, 2008 Have you tried any debugging at all? I would suggest doing this... echo('Input from form: '.$_POST['email'].' - Email after escape: '.$email); Put that on the line before the query, and tell us what it returns. Happy Xmas! ILMV Input from form: - Email after escape: omg both are blank what could be wrong? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 Can you post your FORM please? Quote Link to comment Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 What browser are you using? Internet Explorer by any chance? Fill in the form once more, but this time click the submit button, do not press enter. Tell us if that makes a difference. Quote Link to comment Share on other sites More sharing options...
DimitriDV Posted December 23, 2008 Author Share Posted December 23, 2008 What browser are you using? Internet Explorer by any chance? Fill in the form once more, but this time click the submit button, do not press enter. Tell us if that makes a difference. no difference Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 Are you using method="post" and not method="get"? Quote Link to comment Share on other sites More sharing options...
DimitriDV Posted December 23, 2008 Author Share Posted December 23, 2008 Can you post your FORM please? <form action="results.php" name="survey" method="post"> <table cellspacing="0" cellpadding="3" class="tbl_survey"> <tr> <td>Naam:</td> <td><input type="text" name="naam" id="naam" /></td> </tr> <tr> <td>Voornaam:</td> <td><input type="text" name="voornaam" id="voornaam" /></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="email" id="email" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="toevoegen" id="toevoegen" name="toevoegen" style="margin-left:73px;" /></td> </tr> </table> I already showed you the code of results.php Quote Link to comment Share on other sites More sharing options...
DimitriDV Posted December 23, 2008 Author Share Posted December 23, 2008 ??? I changed the name email into email2 and now it works ??? maybe it was the name of the id? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 I've never found a use for id in HTML and never use it. Unless you need them I'd remove them to save confusion. Quote Link to comment Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 The Id should have nothing to do with it, I'm pretty sure that is for CSS purposes? Looking over all of your code I see no reason why $email won't work, I don't think it is a reserved word!? ILMV Edit: I agree, remove the tags you know you don't need. Quote Link to comment Share on other sites More sharing options...
DimitriDV Posted December 23, 2008 Author Share Posted December 23, 2008 The Id should have nothing to do with it, I'm pretty sure that is for CSS purposes? Looking over all of your code I see no reason why $email won't work, I don't think it is a reserved word!? ILMV Edit: I agree, remove the tags you know you don't need. it looks like it IS a reserved word in *_POST['email'] I need the id for css purposes, I actually meant: I changed the name of the 'name' tag into email2 Quote Link to comment Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 The Id should have nothing to do with it, I'm pretty sure that is for CSS purposes? Looking over all of your code I see no reason why $email won't work, I don't think it is a reserved word!? ILMV Edit: I agree, remove the tags you know you don't need. it looks like it IS a reserved word in *_POST['email'] I need the id for css purposes, I actually meant: I changed the name of the 'name' tag into email2 I understand your previous point, but $_POST['email'], or even $email is not a reserved word. I truly believe there is another problem here. But, if you can avoid it by changing to email2 then that's ok. Quote Link to comment 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.