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 Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/ 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 Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722160 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. Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722161 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? Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722187 Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 Can you post your FORM please? Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722188 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. Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722189 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 Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722195 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"? Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722197 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 Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722198 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? Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722207 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. Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722210 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. Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722211 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 Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722217 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. Link to comment https://forums.phpfreaks.com/topic/138157-insert-into-command-works-for-only-66/#findComment-722222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.