Adobe LiveCycle Form (PHP -> MYSQL)
Posted: Mon Oct 22, 2007 8:03 pm
I have a simple form with firstname and lastname. The submit buttons goes to a php file which added it to a data base. My issue is that all variable are saved to the first variable and saved separately.
Example:
Form Set Up
First Name: Malik
Last Name: Doe
MYSQL Table Data
First Name: maliklastname=doe
Last Name: Null
Any thoughts?
I got the example from http://www.andrewheiss.com/Tutorials?pa ... _and_MySQL
Example:
Form Set Up
First Name: Malik
Last Name: Doe
MYSQL Table Data
First Name: maliklastname=doe
Last Name: Null
Any thoughts?
I got the example from http://www.andrewheiss.com/Tutorials?pa ... _and_MySQL
Code: Select all
<?php
// MySQL connection variables
$host="localhost";
$username="root";
$password="";
$db_name="backstabbers";
$tbl_name="users";
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//Save data from the HTTP POST values submitted from the PDF
$fname=$_REQUEST["firstname"];
$lname=$_REQUEST["lastname"];
$email=$_REQUEST["email"];
// Insert all the data from above into the table in the database
$sql="INSERT INTO $tbl_name(fname, lname, email)VALUES('$fname', '$lname', '$email')";
$result=mysql_query($sql);
// If it worked, say so...
// This will change later on so it won't have the like to view all users, obviously...that's just for testing purposes
if($result){
echo "Successful";
}
else {
echo "ERROR";
}
// Close connection to the database
mysql_close();
?>