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.

Recommended Answers

All 4 Replies

Member Avatar for diafol

Urgh. [ CODE ] tags please.

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

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

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];
...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.