Hi,
I'm trying to setup a web form that will put data into a sql database. I had everything working with a simple test database (first name, last name, phone number). But once I added "address" and "city" to the process, the data collected in the database simply shows "Array(address) " or "Array(city )" and not the actual data I typed into the form. (The other fields work normally).
Any help would be appreciated.
Here is my code:
[CODE=php]<?php
$EntryDate= date('Y-m-d H:i:s');
$con = mysql_connect(" localhost", "login", "password") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_selectdb( "database_name" , $con);
$sql="INSERT INTO data (`EntryDate`, `FirstName`, `LastName`, `Institution`, `Address`, `City`)
VALUES
('$EntryDate', '$_POST[fname]', '$_POST[lname]', '$_POST[inst]', '$_POST(address )', '$_POST(city)' )";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thank you.";
mysql_close($co n);
?>[/CODE]
I'm trying to setup a web form that will put data into a sql database. I had everything working with a simple test database (first name, last name, phone number). But once I added "address" and "city" to the process, the data collected in the database simply shows "Array(address) " or "Array(city )" and not the actual data I typed into the form. (The other fields work normally).
Any help would be appreciated.
Here is my code:
[CODE=php]<?php
$EntryDate= date('Y-m-d H:i:s');
$con = mysql_connect(" localhost", "login", "password") ;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_selectdb( "database_name" , $con);
$sql="INSERT INTO data (`EntryDate`, `FirstName`, `LastName`, `Institution`, `Address`, `City`)
VALUES
('$EntryDate', '$_POST[fname]', '$_POST[lname]', '$_POST[inst]', '$_POST(address )', '$_POST(city)' )";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thank you.";
mysql_close($co n);
?>[/CODE]
Comment