hi, I am seriously inexperienced with both php and mysql, what I am trying to do is have an html form on one page, and run a script to post the information into a table in a mysql database
this is the script:
This was all done through a tutorial, so I really don't know what is happening exactly.
My problem is just that I don't understand how to fit it all with my database. I don't see any way for it to know where or what my database is, my database is called "brandonj_register" and the table I want is called "register"
I'm not really sure if what I want to do makes sense and if it doesn't just tell me. Thanks for looking
this is the script:
Code:
if(isset($_POST['process']) and $_POST['process']==1)
{
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$email = trim($_POST['email']);
$year = trim($_POST['year']);
$grad = trim($_POST['grad']);
$comment = trim($_POST['comment']);
$query = 'INSERT INTO register SET
firstname = "'.$firstname.'",
lastname = "'.$lastname.'",
email = "'.$email.'",
year = "'.$year.'",
grad = "'.$grad.'",
comment = "'.$comment.'",
datetimecreated = NOW()';
if(mysql_query($query))
{
echo '<p style="color:#00F;">Thanks you!</p>';
}
else
{
echo '<p style="color:#C00;">Sorry, your entry could not be submitted.</p>';
}
}
This was all done through a tutorial, so I really don't know what is happening exactly.
My problem is just that I don't understand how to fit it all with my database. I don't see any way for it to know where or what my database is, my database is called "brandonj_register" and the table I want is called "register"
I'm not really sure if what I want to do makes sense and if it doesn't just tell me. Thanks for looking