0

Hello
I have a form containing saveral textbox name1,name2....name50 & father1,father2........father50. what is the best way for desigining and submiting this form and stored in mysql
thank u

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by arctushar
0

name them with "array notation" syntax:

<input name="name[1]" />
<input name="father[1]" />

<input name="name[2]" />
<input name="father[2]" />

<input name="name[50]" />
<input name="father[50]" />

Then, when you post the data, that index will be used to find the related records:

<?php
//on every iteration, $numKey will vary from 1 to 50
//essentially setting $name to name[1], name[2],..., name[50] on every iteration AND
//the corresponding father[$numKey]
foreach( $_POST['father'] as $numKey=>$v )
{
  $name=$_POST['name'][$numKey];
  $father=$_POST['father'][$numKey];
}
?>
This question has already been answered. 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.