Getting info out of a dynamic form and into MySQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
darren
Forum Newbie
Posts: 5
Joined: Thu Sep 22, 2005 3:38 am

Getting info out of a dynamic form and into MySQL

Post by darren »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hello Folks,

I am using the following code to produce a dynamic form.

Code: Select all

$result = mysql_query("SELECT id,weight,date FROM weekly_data WHERE weight IS NULL AND subscr_id = '$toss' AND date <= now()");
if (!$result) {
   die('Invalid query: ' . mysql_error());
}
print"<table width='100%' id='catchup'  border='0' cellspacing='0' cellpadding='0'>";
print "<form name='form1' id='form1' method='post' action='catchupprocess.php'>";
print"<tr>";
print"<td></td>";
print"<td>Weight</td>";
print"<td>Date</td>";
print"<td>Waist</td>";
print"<td>Measure</td>";
print"<td></td>";
print"</tr>";
while ($row = mysql_fetch_array ($result)){
//echo $result;
print"<tr>";
print"<td>";
print"<input name='".$row['id']."' size='4' type='text' value='".$row['id']."'/>";
print"</td><td>";
print"<input type='text' size='6' name='weight".$row['id']."' value=''/>";
print"</td><td>";
print"<input type='text' size='10' value='".$row['date']."'/>";
print"</td><td>";
print"<input type='text' size='3' name='waist".$row['id']."' value=''/>";
print"</td><td>";
print"<input type='text' size='6' value='$measure'/>";
print"</td><td>";
print"<input type='hidden' size='10' value=''/>";
print"</td>";
print"</tr>";
}
print"<tr>";
print"<td>&nbsp;</td>";
print"<td><input name='Reset' type='reset' value='Reset'></td>";
print"<td>&nbsp;</td>";
print"<td><input name='submitcatchup' type='submit' value='Submit'></td>";
print"<td>&nbsp;</td>";
print"</tr>";
print"</form>";
print"</table>";
?>
But I am sbsolutely stumped as to how to get the information out of the form, and into a MySQL database. Any pointers would be greatfully received.

Darren


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the submission information will be inside $_POST, however, if you are running the page(s) in standards compliance mode, you may not get anything (from a compliant browser) as you have placed the form tag(s) in "illegal" locations.
Post Reply