ok, very simple task, some time consuming.
i would say create the script as php.
we'll call it "register.php"
//// the following was made
--------------------
if($_GET['step'] == "1"){
//this will be a simple form with: Name - first, last, email, phone
echo"
";
}
if($_GET['step'] == "2"){
//connect to database, host type goes in localhost. generally host type is localhost, if unsure leave alone.
//username is the database login username, sometimes may include prefix
//password is the database login password
//database is the database name, may include prefix
$connection = mysql_connect(localhost, username, password)
or die(mysql_error());
$db = mysql_select_db(database, $connection)
or die(mysql_error());
//database table: called 'table' and is the name of your database table
//please label the fields, they have been labeled automatically for a demo taste
$query = "INSERT INTO table (firstname,lastname,phone,email)
VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[phone]','$_POST[email]')";
$resultB = mysql_query($query,$connection) or die ("Coundn't execute query.");
$to = "$_POST[email]";
$subject = "my message here";
$headers = "From: my website name";
$msg = "Thank you for signing up with us $_POST[firstname] $_POST[lastname]!
Visit us soon again! at ourwebsite.com";
mail($to, $subject, $msg, $headers);
}
?>
--------------------
Ok how it works is that the form is set as a parameter of register.php, its parameter is called: step=1, with the attachment of ?, so the full url will be: register.php?step=1
Now this has form details, and only form details. When pressed submit, the form details gets sent to register.php?step=2, of course you can add if then statements to test if everything is completed, and done accurately.
Now in the step=2 parameter we have the database connections and the mailing daemon. follow the comments on the script to change the database details, and connection type.
$query can also be modified to what your fields are called, and the table their in. please try to stick with the order it is in, so dont move firstname to the end, and email to the front. and dont change the values.
below this we have the mailer.
subject can be edited and headers (the brackets and everything in it.
also the message can be edited.
whenever taking variables from a form use the following code: $_POST[fieldName]
change the fieldName to whatever your field is called.
best luck, more information contact alco19357@yahoo.com
alex
2006-11-02 15:29:38
·
answer #3
·
answered by alco19357 5
·
0⤊
0⤋