If anyone can help with this problem that would be great. I have writen a program that pulls data from a table skus and quantity, i stuff the items into an array and have a form print the data (part 1). after it is submitted i do a check for the array yes (part 2) which brings back all the skus and updated quantitys except for some reason it always keeps taking the last element of the sku out/or perhaps not displaying?. any ideas anyone?
part 1
print "<form>";
echo "<center><table bgcolor='E0FFFF' border=1>";
print "<tr><td><b>SKU</b></td><td>quantity on hand</td><td>quantity sold</td></tr>";
foreach ($skus as $sk => $qt ) {
print "<tr><td>$sk</td><td align='right'>$qt</td>";
printf(" <td> <input type='text' name=yes[%s] value='0'> </td>\n",$sk);
print "</tr>";
}
print "<tr><td></td><td></td><td><input type=submit value='invoice now'></td></tr>";
echo "</table></center>";
print "<input type=hidden name=option value='invoice'>";
print "<input type=hidden name=suboption value=1>";
print "</form>";
part 2
if ($suboption) {
print "<center><table border=1>";
if (is_array($yes)) {
foreach ($yes as $sk => $qt) {
print "<tr><td>Sku</td><td>$sk</td><td>Amount</td><td>$qt</td></tr>";
}
print "</table></center>";
} print "finished";
fun with text boxes and arrays. last element gets axed help?
Moderator: General Moderators
- massiveone
- Forum Commoner
- Posts: 29
- Joined: Tue Jun 18, 2002 4:39 pm
- Location: Canada
- Contact:
- massiveone
- Forum Commoner
- Posts: 29
- Joined: Tue Jun 18, 2002 4:39 pm
- Location: Canada
- Contact:
doh! the real problem
The Real Problem after some pain staking tests is that one of my skus
has a space in it!!!! how do i get it to work with spaces...
any ideas?
Thanks
has a space in it!!!! how do i get it to work with spaces...
any ideas?
Thanks
by quoting the values
comparetoin the first element the browser has no chance to determine what belongs to value and what might be the next parameter
compare
Code: Select all
<input type=text value=with a blank>Code: Select all
<input type="text" value="with a blank" />- massiveone
- Forum Commoner
- Posts: 29
- Joined: Tue Jun 18, 2002 4:39 pm
- Location: Canada
- Contact: