Re: installing a database in front page ? | |
Frontpage has nothing to do with writing the data in your database. After you have created your form in frontpage, you need a script (usually in php, to process the info submitted by the form. If you are using a php script to process your form info, you will have to add some lines of code in the script, in order to have the info writen in the database. Then, of course, you will need another script to retreive the info from the database, and have it presented in one of your pages.
Although there are such script examples on the net, they are usually hard to create and use, unless you have some knowledge of php and MySQL.
Lets suppose that you already have in your script a part that will define three variables $address, $lastname and $name getting them from the array submitted by the form. You now want to write these three values in your database.
Here is an example of what the writing piece of code could look like:
@$pfw_strQuery = "INSERT INTO `clients`(`address`,`lastname`,`name`)VALUES (\"$address\",\"$lastname\",\"$name\")" ;
@$pfw_host = "localhost";
@$pfw_user = "dbusername";
@$pfw_pw = "bdpassword";
@$pfw_db = "dbname";
$pfw_link = mysql_connect($pfw_host, $pfw_user, $pfw_pw);
if (!$pfw_link) {
die('Could not connect: ' . mysql_error());
}
$pfw_db_selected = mysql_select_db($pfw_db, $pfw_link);
if (!$pfw_db_selected) {
die ('Can not use $pfw_db : ' . mysql_error());
}
//insert new record
$pfw_result = mysql_query($pfw_strQuery);
if (!$pfw_result) {
die('Invalid query: ' . mysql_error());
}
mysql_close($pfw_link);
These lines will write the three variables, name, lastname and address in the database, in the table "clients", in their respective fileds.
__________________
Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!
Last edited by navaldesign; 05-24-2006 at 10:11 PM.
|