0

hi friends,

my database names are like that:

--name surname date account---

i want to send 5 or more user info send database with form.

form.php
<input type="text" name="name" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="surname" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="account" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="date" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="date" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="date" size="8" class="auto-style5" style="height: 20px">
<input type="text" name="date" size="8" class="auto-style5" style="height: 20px">


send.php
$name = $_POST;
$surname = $_POST;
$accont = $_POST;
$date = $_POST;

INSERT INTO aaaa (name,surname,account,date)
VALUES ('$name','$surname','$accont','$date);


now user fill the form.php all info with 4 dates info. send.php insert into database like that


name surname account date
-----------------------------
a b 10 01022011
a b 10 07022011
a b 10 11032011
a b 10 05062011

i want to send like that. only date info different other information same.


how can i do this with php and mssql ?

thanks.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by smantscheff
0

Replace name="date" by name="date[]" .
Then in send.php walk through the array $_POST['date'] and generate an INSERT query for each element.

0

Replace name="date" by name="date[]" .
Then in send.php walk through the array $_POST['date'] and generate an INSERT query for each element.

$date = $_POST; how can i do that this part. ?


name = "date[]" and $date = array($_POST);

like that ? if no, how i can write this part

0

If the form contains names like "date[]", the receiving $_POST array contains an element named "date" which is an array of key/value pairs which contains all the date values of the form. So you might have

$date1 = $_POST['date'][0];
$date2 = $_POST['date'][1];
...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.