MinnisotaFreezing
Programmer
A few questions.
$first = $_POST['first_name'];
if ($_POST['submit'] == "Enter"
{
$query = "insert into names
(first, last) values
('$first', '$_POST['last_name']')";
mysql_query($query) or
die (mysql_error());
?>
first is inserted into my table, last_name is not. Is there a way I can write my insert string so I don't have to pass the global variable into a local one, like I did for first_name?
More importantly, if I simply take the posted global variables and insert them into my table, am I missing the whole point of turning global variables off? This is not sensitive data, but I would like to learn things right. Should I pass all POST data into local variables and run some validity check on them before inserting?
Thanks for the help, sorry if this is a bit muddled.
CJB
$first = $_POST['first_name'];
if ($_POST['submit'] == "Enter"
{
$query = "insert into names
(first, last) values
('$first', '$_POST['last_name']')";
mysql_query($query) or
die (mysql_error());
?>
first is inserted into my table, last_name is not. Is there a way I can write my insert string so I don't have to pass the global variable into a local one, like I did for first_name?
More importantly, if I simply take the posted global variables and insert them into my table, am I missing the whole point of turning global variables off? This is not sensitive data, but I would like to learn things right. Should I pass all POST data into local variables and run some validity check on them before inserting?
Thanks for the help, sorry if this is a bit muddled.
CJB