Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Adding details to my database


  • Please log in to reply

#1
andy_b_1502

andy_b_1502

    Member

  • Member
  • PipPip
  • 40 posts
Hi,

Im having a but of a nightmare here and need help before i breakdown :)

Ive made a simple web form on my site so customers can fill out there details, when the submit button is clicked a php script should send these details to my MySql database.

This isnt happening. Instead all i see in my phpMyadmin is "ARRAY | ARRAY | ARRAY" where the details should be?

This is my html form code:

<form method="post" action="sendform.php">
Your Name:<br />
<input type="text" name="name[]" /><br />
Email Address:<br />
<input type="text" name="email[]" /><br />
Your Product (graphics/tinting/printed clothing:<br />
<input type="text" name="product[]" /><br />
Short Description Of Product And Any Questions/Comments:<br />
<textarea name="message[]" rows="10" cols="40"></textarea><br />
<input name="Send it!" type="submit" id="Send it!" value="Send it!" />
</form>

This is the php script (sendform.php):

<?PHP

$user_name = "handy";
$password = "*****";
$database = "database2";
$server = "handygraphicscouk.ipagemysql.com";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "INSERT INTO Customers (name, email, product, message)
VALUES ('" .$name. "', '" .$email. "', '" .$product. "', '" .$message. "' )";
$result = mysql_query($SQL);

mysql_close($db_handle);

print "Records added to the database";
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}

?>


I tested this by typing in "test" in each textbox on my web form and all i get returned is "Array" for each section?

I also would like the user to be re-directed back to a thankyou page but ill sort that out at a later date until this problem is solved?

If you need any more information let me know.

Any help or suggestions with this would be massivley welcomed. Please help!!

Many thanks

Andy
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP