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

Recommended Answers

All 2 Replies

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];
}
?>

thanks u.

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.