Page 1 of 1

Getting info out of a dynamic form and into MySQL

Posted: Sat Oct 08, 2005 12:28 pm
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]

Posted: Sat Oct 08, 2005 12:46 pm
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.