Jump to content

Insert Into command works for only 66%


DimitriDV

Recommended Posts

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

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

$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.

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  :o both are blank  :o

what could be wrong?

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

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.

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  ;)

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.