Jump to content

Form values


backinblack

Recommended Posts

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!';

?>

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.