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: - <?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($con);
-
-
?>
3 1457 -
('$EntryDate', '$_POST[fname]', '$_POST[lname]', '$_POST[inst]', '$_POST[address]', '$_POST[city]' )";
-
Mind the Brackets. It should be square ones. not the parenthesis.
Guess I was in a hurry to get things working.
Thank you very much.
Guess I was in a hurry to get things working.
Thank you very much.
Glad to hear that.Good luck with your projects. If you ever need anything post back to the Forum.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: cooldv |
last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this
code:
message = Replace(usermessage, "'", "''").
My problem is DISPLAYING data in an asp FORM, from an an access
database,...
|
by: PinkBishop |
last post by:
Hello All,
Hope you can help.
Below is the code I use to send data from form to database.
Problem is if an apostrophe is entered in cQuestion field or any field
for that matter the form...
|
by: intl04 |
last post by:
How do I create a data input form in Access that is external to the
Access database to which it's connected (if that's possible, which I
believe it is)? For example, if someone clicks on an Access...
|
by: intl04 |
last post by:
Is it possible to create a Word form as the data entry form for an
Access database? I didn't see any reference to this possibility in my
Access books, so I'm sorry if this is a question that is...
|
by: Steve |
last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I
have code that sets the default value of each field to its current value. For a
new record, I can put the focus in any...
|
by: sparks |
last post by:
We have a database that reads in and formats raw data. We were using
queries to format the data per person and outputing reports.
The other database has the persons personal information. I changed...
|
by: pd123 |
last post by:
I'm new to C# and .net and I'm trying to create a form that will register users in a sql server database. I have the following code but when I run the code I get an error "
The name 'Peter' is...
|
by: Robert |
last post by:
I am trying to give the user dynamic search capabilities to select
almost any record in the database from criteria they select. Everything
seems to work except when I open the display form to...
|
by: kev |
last post by:
Hi all,
I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end...
|
by: Kevin Davis |
last post by:
Hello,
I'm a new person when it comes to PHP and I have a quick question.
I would like to create a form that will allow the user to add more
information using the same form in case they have...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |