ankycooper Posted September 23, 2006 Share Posted September 23, 2006 hii have a form with fields name age gender email.i want to insert multiple records into a dataase with 1 formNeed some helpGood informative links are welcomeThis is my script and i'm trying to insert mutiple data rows with 1 form[code]<?phpsession_start();if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true || !isset($_SESSION['role']) || $_SESSION['role'] !=="Manager") { // not logged in, move to login page header('Location: ../login.php'); exit;}include '../config/dbinfo.inc.php';@mysql_connect($host,$user_name,$pass_word)or die( "Unable to Connect to database");@mysql_select_db($database) or die( "Unable to select database");$specialty=$_GET['specialty'];$mmyy=$_GET['mmyy']; $query = "SELECT * FROM emp WHERE specialty = '$specialty' and role='Engineer' or specialty = '$specialty' and role='TL-ATL' order by mgr"; $result = mysql_query($query) or die('Error : ' . mysql_error()); if (isset($_POST['sdate*']) && isset($_POST['edate*']) && isset($_POST['now*'])){function dateconvert($date,$func) { if ($func == 1){ //insert conversion list($day, $month, $year) = split('[/.-]', $date); $date = "$year-$month-$day"; return $date; } if ($func == 2){ //output conversion list($year, $month, $day) = split('[-.]', $date); $date = "$day/$month/$year"; return $date; }}$specialty=$_GET['specialty'];$mmyy=$_GET['mmyy'];$sdate=$_POST['sdate*'];$sdate=dateconvert($sdate, 1);$edate=$_POST['edate*'];$edate=dateconvert($edate, 1);$now=$_POST['now*'];while(list($id) = mysq[/code] Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 23, 2006 Share Posted September 23, 2006 What do you need help with?What doesn't work with the code you have already written?If you're looking for a 'how do I add information to a database', take a look at the tutorials linked from the home page of phpfreaks.comUnderstand the the object of 'help' is help, not 'what can we write for you' ;D Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 23, 2006 Share Posted September 23, 2006 Like all moderators and admins, I would prefer that you not email me personally about this.For those interested, the other half of this problem is the code you'll find at http://www.halfadot.com/temp/script.txt Quote Link to comment Share on other sites More sharing options...
Barand Posted September 23, 2006 Share Posted September 23, 2006 Similar problem with solution herehttp://www.phpfreaks.com/forums/index.php/topic,108196.msg439902.html#msg439902 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.