View Single Post
Old 05-22-2006, 04:22 PM   #2 (permalink)
etono
Moderator
 
Join Date: May 2006
Posts: 86
Default Re: form handling problem

I would name the inputs like this:
Code:
Creator: <input type="text" name="chefs[]" size=40><br/><br/> Restaurant: <input type="text" name="restaurants[]" size=40><br/><br/> Meal: <input type=text name="meals[]" size=140><br /><br/>

Then I would insert each element of the array on your process.php page like this:
Code:
<?php foreach( $_POST['chefs'] as $chef ) { // add chef to chefs database mysql_query( "INSERT INTO chefs ( name ) VALUES ( '$chef' )" ); } //same idea for restaurants and meals ?>

You should also be doing some validation of your form data before inserting it into your database to avoid sql injection. Also you should make sure to escape your strings before inserting it.
__________________
Jeremy Moseley
My Links: Design Related Blog | Personal Website | Portfolio
etono is offline   Reply With Quote
Sponsored Links