Page 1 of 1
Data not going into database
Posted: Sun Feb 22, 2004 10:11 am
by rfigley
I have a form, submitting data to the database, and all is going in except for paragraph_1. No errors. The text just not going into the field of the database. All others are going fine.
Here's the HTML form to enter the data:
<input name="newsletter_title" size="100">
<input name="newsletter_title2" size="100">
<textarea name="paragraph_1" cols="75" id="paragraph_1"></textarea>
<textarea name="paragraph_2" cols="75" id="paragraph_2"></textarea>
Here's the command inserting into the table:
Code: Select all
$sql = "INSERT INTO tbl_newsletter_sections (newsletter_title,newsletter_title2,paragraph_1,paragraph_2)
VALUES ('$newsletter_title','$newsletter_title2','$paragraph_1','$paragraph_2')";
Posted: Sun Feb 22, 2004 10:20 am
by tim
what are u using for a action on the form? How/where are u passing the variables?
Posted: Sun Feb 22, 2004 10:27 am
by rfigley
The action is as follows: <form action="edit_newsletter_now.php">
the "edit_newsletter_now.php" file contains the insert command shown,
Posted: Sun Feb 22, 2004 10:30 am
by markl999
If you echo $sql; before inserting into the db, do you see the paragraph_1 info ok? If so then the problems probably with the form, otherwise it's probably on the db side. I'm presuming the paragraph_1 type and the paragraph_2 type are the same in the db?
Posted: Sun Feb 22, 2004 4:24 pm
by evilMind
Check to see that paragraph_1 is being picked up upon form submission.
eg: right after the $sql assignment do a " die($sql); " check to make sure that the query looks proper (' and " are escaped etc.)
Posted: Sun Feb 22, 2004 6:33 pm
by John Cartwright
evilMind wrote:Check to see that paragraph_1 is being picked up upon form submission.
eg: right after the $sql assignment do a " die($sql); " check to make sure that the query looks proper (' and " are escaped etc.)
' (single quotes) do not need to be escaped

Posted: Sun Feb 22, 2004 6:35 pm
by John Cartwright
Code: Select all
<?php
$sql = "INSERT INTO tbl_newsletter_sections SET newsletter_title='$newsletter_title',newsletter_title2='$newsletter_title2',paragraph_1='$paragraph_1',paragraph_2='paragraph_2'";
?>
Try this?
Posted: Sun Feb 22, 2004 8:41 pm
by evilMind
Phenom wrote:evilMind wrote:Check to see that paragraph_1 is being picked up upon form submission.
eg: right after the $sql assignment do a " die($sql); " check to make sure that the query looks proper (' and " are escaped etc.)
' (single quotes) do not need to be escaped

single quotes need to be escaped if you're query consists of single quotes. Actually for security reasons ALL QUOTES should be escaped.