Log in

View Full Version : Form that Create account for visitors (PHP Mysql Database)



akluch2
01-29-2008, 03:38 PM
I am very new to database, I am used to designing forms in html, that is, webmail. Integrating databsae now to achive the following three objectives is hard for me:
1. To create a form that will enable a site visitor create an account and have the data entered in the form fields submitted to a PHP MySQL database.

2. As soon as the form is submitted I want
auto-response sent to the email address of the visitor
in form of acknowledgement. This email address will be
the visitors user name.

3. When the above is done how will it be possible for the
visiter to login to his account?

Below is the form I designed in html. Could you tell me what to do now to achive the above three objectives:


<html>

<head>
<title>Create an account</title>
</head>

<body>
<p><font face="Arial" style="font-size: 9pt" color="#505050">
Create a new account with us.</font></p>
<table border="0" cellpadding="0" cellspacing="0" width="346" id="table126"><tr><td width="346">
<font face="Arial" style="font-size: 9pt">
First Name:<input name="FName" <br>
Last Name:<input name="LName" <br>
Company:<input type="text" name="Company" <br>
Address1:<input type="text" name="Address1" <br>
Address2:<input type="text" name="Address2" <br>
Telephone:<input type="text" name="Telephone" <br>
Your Email:<input type="text" name="email" <br>
Re-Enter Email:<input type="text" name="Confirm_Email" <br>
Password:<input type="password" name="Password" <br>
Confirm Password:<input type="password" name="Confirm_password" <br>
<input type="submit" value="Continue" </td></tr></table>
</body></html>

Someone help. Thanks.

Rockonmetal
01-29-2008, 10:50 PM
First you need these things:
1. A MySQL server... *
2. Some php scripts *this will send the information to the server and email to the client...*
3. Validation
Some good php-mysql reference is at http://www.w3schools.com/php/
http://www.w3schools.com/mysql/ (http://www.w3schools.com/php/)

If you have time, you should mess around with php on your computer, I don't know how to do it but I know there are many people who can help you get it to work...

If you don't have time, you are gonna need stuff like this:


<?php
$con = mysql_connect("Server_IP","administrator_login_username","admin_password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("database_name", $con);

$result = mysql_query("SELECT * FROM TableName WHERE RowName='Data'");//For the RowName you can also put variables like $username...

while($row = mysql_fetch_array($result))
{
$Password = $row['Password']; /*This gets the selected Password from the row you selected and it puts it into a variable called "Password"... */
$Username = $row['Username']; /*This gets the selected Username from the row you selected and it puts it into a variable called "Username"... */


}
}
?>
I don't have the time at the moment to make you a custom scripts...
Good luck and let the Php/Mysql/ force be with you!

akluch2
01-30-2008, 12:10 PM
Thanks. My website is hosted with Godaddy. Below is the copy of the gdform script. Can you tell if and how I can modify it now to include the script you sent me so that I can upload it.

<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>


Thanks in advance.

Rockonmetal
01-30-2008, 10:35 PM
I've never seen that... it looks as if its a redirection script... i don't know what it is...

thetestingsite
01-30-2008, 10:50 PM
gdform.php is (I think), is just a contact form that writes the info to a file (that is viewable in the godaddy control panel). What the OP is looking for is an original script to create and manage accounts for his/her website. The best bet would be to look through the tutorials located at the following website so that you can get an idea of what you need to do.

http://www.php-mysql-tutorial.com/user-authentication/database.php

Hope this helps.

akluch2
02-11-2008, 02:01 PM
Thanks for all the responses. The links: http://www.php-mysql-tutorial.com/us...n/database.php http://www.w3schools.com/php/ http://www.w3schools.com/mysql/ have been very helpful. I am now learning fast. I have two problems now:

1. At the top of each page of my site I want to create a code that will read 'Account Login' on page load. Then if a user logs in, it should now read 'Welcome user Logout', user being the first name of the user.

2. I want to create a single profile page for members. The way I want it is when any user logs in he will authomatically be taken to that single profile page. I am wondering if there is a way I can make the code extract only the profile and passport of that member and display for him to view. Each loged in member can only view his own profile at that single page.

Someone help. Thanks.