backinblack Posted January 1, 2008 Share Posted January 1, 2008 I have two form fields that are duplicated like this shown below. Since they are duplicate I have even tried to put then in a array but it goes in the mysql as array and what I have shown below in enters just the last one. It actually will have up to 20 instead of the 2 I show. I am trying this so I don't have to enter one at a time. Is this possible? I can't find anthing talking about the same name values in a form. <html> <head> <title>Address form</title> </head> <body> <form action="processform.php" method="post"> <table> <tr><td><input type="text" name="yourname" length="20"></td><td><input type="text" name="address"></td> </tr> <tr><td><input type="text" name="yourname" length="20"></td><td><input type="text" name="address"></td> </tr> </html> </body> </html> ---------------------------------------------------------------------------- //processform.php <?php $carnumber = $_POST['name']; $name = $_POST['address']; $host=""; $user=""; $password=""; $database = ""; $connection = mysql_connect($host,$user,$password) or die ("Could not retrieve information"); $db = mysql_select_db($db,$connection) or die ("Could not make connection"); $query = "INSERT INTO clients values ('$name', '$address')"; $results=mysql_query($query) or die (mysql_error()); if ($results); echo 'Your information has been added!'; ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted January 1, 2008 Share Posted January 1, 2008 The 2nd name="address" will overwrite the first one. You can't use the same name twice like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.