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

Link to comment
Share on other sites

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

 

Input from form: - Email after escape:

 

omg  :o both are blank  :o

what could be wrong?

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.