Gossamer Forum
Home : General : Internet Technologies :

insert problem

Quote Reply
insert problem
hello, i'm new here and i suprise suprise, i'm new to Php too.

I'm havin a problem inserting some simple data into a mysql database using php.

Here is my form

<FORM METHOD=POST ACTION="handleform.php">
Firstname<INPUT TYPE="text" NAME="Array[Firstname]" size=20><BR>
Lastname<INPUT TYPE="text" NAME="Array[Lastname]" size=40><BR>
EmailAddy<INPUT TYPE="text" NAME="Array[Emailaddress]" size=60><BR>
Your Comments<TEXTAREA NAME="Array[Comments]" ROWS=5 COLS="40"></TEXTAREA>
<INPUT TYPE="submit" Name="submit" value="Submit your details!">

and heres my php form :

/* This page recieves and handles the information from Form.html */

$Array["Firstname"] = trim
$Array["Lastname"] = trim
$Array["Emailaddress"] = trim
$Array["Comments"] = trim

// Set the variables for the database access:
$host = "localhost";
$user = "Redeemer";
$password = "";
$dbname = "yourComments2";
$stuff = "Feedback";

$Link = mysql_connect ($host, $user, $password);

$Query = "INSERT into $stuff values ('0', '$Array[Firstname]', '$Array[Lastname]', '$Array[Emailaddress]', '$Array[Comments]')";

print ("$array[Firstname]");
print ("The query is:<BR>$Query<p>\n");

if (mysql_db_query ($dbname, $Query, $Link)) {
print ("Your information has been updated =;0)<BR>\n");
} else {
print ("Your information has not been updated<BR>\n");
mysql_close ($Link);

heres the result:

The query is:
INSERT into Feedback values ('0', '', '', '', '')

Your information has been updated =;0)

Any ideas??

Subject Author Views Date
Thread insert problem Redz^ 5595 May 26, 2003, 6:31 AM
Post Re: [Redz^] insert problem
Andy 5404 May 26, 2003, 8:11 AM
Thread Re: [Redz^] insert problem
Andy 5411 May 26, 2003, 8:14 AM
Post Re: [Andy] insert problem
Redz^ 5392 May 26, 2003, 9:37 AM