retrieving varibles submitted from a form from array??
Posted: Thu Jan 05, 2006 11:14 am
Jcart | Please use
Jcart | Please use
Code: Select all
andCode: 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]
I cannot figure out the data that I submit is not being displayed in as the values when this form is sumitted. All said and done I will need the data to be added to a database.
The "field_count" works, when I type in 2 submit it reloads, and 2 is still the value of that input box. but the 3 other fields that have the _$i won't.Code: Select all
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="test_form.php" method="post">
<input type="text" name="field_count" size="5" value="<?php echo $_POST['field_count']; ?>">
<input name="submit" value="Go" type="submit" onClick="document.add_marginworksheet.submit()">
<table>
<?php
$field_count = $_POST['field_count'];
for($i= 1;$i <= $field_count;++$i)
{
echo "
<tr>
<td align='left' width='90'>Model:<br><input type='text' size='10' name='model_$i' value=\"".$_POST['model_$i']."\" ></td>
<td align='left'>Description:<br><input type='text' size='40' name='description_$i' value=\"".$_POST['description_$i']."\" ></td>
<td align='right'>Price:<br><input type='text' size='10' name='price_$i' value=\"".$_POST['price_$i']."\" ></td>
</tr> ";
};
?>
</table>
<input type="submit" value="submit" name="Submit">
</form>
</body>
</html>Jcart | Please use
Code: Select all
andCode: 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]