Jump to content

Welcome to Geeks to Go - Register now for FREE
Geeks To Go is a helpful hub, where thousands of friendly volunteers serve up answers and support. Get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message and all ads will be removed once you have signed in.
Create an Account Login to Account

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

Advertisement



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

featured