08-23-2006, 07:52 AM
I have a script that inserts a variable into the database,
so how do i make my form my variable,
i know that with js its like this:
is this a legal php one?
08-23-2006, 09:30 AM
The form has to be submitted to a php script but then it would be accessed like
$name = $_POST['inputname'];
//or $_GET if form method is get instead of post
08-23-2006, 11:12 AM
thanks!!! however, I have encountered another problem, now this is a bit off topic but i want to send a variable to a table. will this work?
//records username and password into database
$con = mysql_connect("mysql2.freehostia.com","glysim_userpass","******");
die('Could not connect: ' . mysql_error());
mysql_query("INSERT INTO usernames (username, password)
VALUES ($username, $password)");
08-24-2006, 05:31 AM
Instead of asking us if it will work, why not just try it and see?
08-24-2006, 06:07 AM
Below is what I use. It's a quick cut and paste but easy to figure out, I'm sure there is other variations that will also work.
mysql_query("INSERT INTO canadastore (item_catagory, item_image,
item_title, item_description, item_price, item_location, item_email, item_date)
VALUES ('$_POST[catagory]', '$_POST[date_image]', '$_POST[item_title]',
'$_POST[item_description]', '$_POST[item_price]', '$_POST[item_location]',
'$_POST[item_email]', '$_POST[item_date]') ")
08-24-2006, 08:19 AM
Thanks for everyones input, but now i'm finished.