samsina Posted July 13, 2007 Share Posted July 13, 2007 I have problem. So at work I am making this gigantic form, everything done except this part. here is the database view: name, phone , type ex: sam , 12345678, installation ex: jim , 12222222, support html view (fixed size of three for each): install name:_____ phone:______ name:_____ phone:______ name:_____ phone:______ support name:_____ phone:______ name:_____ phone:______ name:_____ phone:______ submit so basically the form includes from contact lists 1)installation group 2)support group into one database. the easier way to name each field as a unique text boxes and process them one at a time... any efficient way? Link to comment https://forums.phpfreaks.com/topic/59865-multiple-form-textbox-problem/ Share on other sites More sharing options...
Barand Posted July 13, 2007 Share Posted July 13, 2007 try something like this <?php if (isset($_GET['sub'])) { foreach ($_GET['name'] as $type=>$names) { foreach ($names as $k => $name) { $phone = $_GET['phone'][$type][$k]; $sql = "INSERT INTO mytable (name, phone,type) VALUES ('$name', '$phone', $type')"; echo "<pre>$sql</pre>"; // update here } } } ?> <form> <h3>Installation</h3> <?php for ($i=0; $i<3; $i++) { echo <<<TXT Name <input type="text" name="name[installation][$i]"> Phone <input type="text" name="phone[installation][$i]"> <br /> TXT; } ?> <h3>Support</h3> <?php for ($i=0; $i<3; $i++) { echo <<<TXT Name <input type="text" name="name[support][$i]"> Phone <input type="text" name="phone[support][$i]"> <br /> TXT; } ?> <input type="submit" name="sub" value="Submit"> <form> Link to comment https://forums.phpfreaks.com/topic/59865-multiple-form-textbox-problem/#findComment-297691 Share on other sites More sharing options...
samsina Posted July 16, 2007 Author Share Posted July 16, 2007 thanks alot. Link to comment https://forums.phpfreaks.com/topic/59865-multiple-form-textbox-problem/#findComment-299665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.