Hey All,
I’m very new to PHP, and am a young guy at that (16), no don’t get me wrong I’m a smart kid, I just need time to perfect my skills
Anyhow, the following the the script I wrote. Here’s basically what I’m trying to do:
1) A user, in a previous HTML page has inputted data into a form
2) They press submit and the data SHOULD be processed through a PHP form
3) I want that data to be entered into a database table. The database and table are fully set up.
4) The script will have created the user and the user will now be able to login.
[url]www.mobitek.ca/createuser-builder/formto.html
Here’s the script:
[code=php]
<?php
$username = $_POST[“username”];
$password = $_POST[“password”];
$name = $_POST[“name”];
$address1 = $_POST[“address1”];
$address2 = $_POST[“address2”];
$city = $_POST[“city”];
$state = $_POST[“state”];
$zip = $_POST[“zip”];
$country1 = $_POST[“country1”];
$phone = $_POST[“phone”];
$email = $_POST[“email”];
$admin = $_POST[“admin”];
$country2 = $_POST[“country2”];
$link = mysql_connect(‘localhost’, ‘mobitek_build’,
‘PASSWORD’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
echo ‘Connected successfully’;
$query = “INSERT INTO compb_users ( id , username ,
password , name, address , city , state , zip , country1 , phone
, email , admin , country2 )
VALUES (
‘$id’, ‘$username’, ‘$password’, ‘$name’, ‘$address’, ‘$city’,
‘$state’, ‘$zip’, ‘$country1’, ‘$phone’, ‘$email’, ‘$admin’,
‘$country2’)”;
mysql_query($query) or die (‘Error creating user’)
echo “Thank you”;
?>
Thanks for the help in advance, Justin.