pgsjoe Posted August 31, 2006 Share Posted August 31, 2006 I'm sure there's a name for what I'm looking for, I just don't know it, or how to do it. Basically, I have a form for people to enter their teams. So they would put the name for team, then each person's name, e-mail and phone. I then want these to enter into the database in 4 fields. Team Name, Name, E-mail, Phone...but for each person. So how would I do such a thing? Thanks in advance. I really appreciate it. Quote Link to comment Share on other sites More sharing options...
Orio Posted August 31, 2006 Share Posted August 31, 2006 form.htm[code]<form action="update_db.php" method="POST"><!-- <1> --><input type="text" name="1team"><input type="text" name="1name"><input type="text" name="1email"><input type="text" name="1phone"><!-- </1> --><!-- <2> --><input type="text" name="2team"><input type="text" name="2name"><input type="text" name="2email"><input type="text" name="2phone"><!-- </2> --><!-- <3> -->...<!-- </3> --></form>[/code]update_db.php[code]<?php$max=3; //the number of "Sets" we got$i=1;while($i<=$max){$team=$i."team";$name=$i."name";$email=$i."email";$phone=$i."phone";mysql_query("INSERT INTO `table_name` VALUES ('$team', '$name', '$email', '$phone')");}?>[/code]Of course you need to add validation, SQL injection protection etc'. But that's the main idea :)Orio. Quote Link to comment Share on other sites More sharing options...
pgsjoe Posted August 31, 2006 Author Share Posted August 31, 2006 YES! That's exactly what I was looking for. You rule. Thank you. 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.