Jump to content


Form submission using php pagination and array from db


  • You cannot reply to this topic
No replies to this topic

#1 xmlhelpneeded

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 28 December 2008 - 04:17 PM

i am using pagination mysql db and php and my form will give me the results for the last item in my paginated list but not for any other item in my list, i know there is a simple fx for this but am unsure because of the pagination as to how to do this.
while ($i = mysql_fetch_array($result))
 {
 
 //foreach($i as $j)
 //{
 //$item[$_POST[$i[Fitem]]] = "SELECTED";
 echo '<td>'.$i[Fitem].'<input type=hidden name="item" value="'.$i[Fitem].'"></b></p></td>';
 echo '<td>'.$i[fEffect] .'</b></p></td>';
 echo '<td>'.$i[fCost] .'<input type=hidden name="cost" value="'.$i[fCost].'"></b></p></td>';
 //}
 $quantity[$_POST['quantity']] = "SELECTED";
 echo "<td><p><select name=\"quantity\" id=\"select2\">
 <option value=\"0\">0</option> 
 <option value=\"1\">1</option>
 <option value=\"2\">2</option>
 <option value=\"3\">3</option>
 <option value=\"4\">4</option>
 <option value=\"5\">5</option>
 <option value=\"6\">6</option>
 <option value=\"7\">7</option>
 <option value=\"8\">8</option>
 <option value=\"9\">9</option>
 <option value=\"10\">10</option>
 </select></p></b></p></td></tr>";
 
 
 }
 //}
 //echo '</tr>';
 echo '<tr><td><input type="submit" name="Submit" value="Purchase"></td></tr></form></table>';
 echo $pagination." ";
in my form file this is the code to display the results
if ($_POST['Submit'] == 'Purchase')
 {
 include"header.php";
 
 
 echo "<br />This is the quantity you requested: ".$_POST['quantity']."<br />";
 echo "This is the item you requested: ".$_POST['item']."<br />";
 echo "This is the cost of the item you requested: ".$_POST['cost'];
 }

Thanks in advance for any help with this.

Edited by xmlhelpneeded, 28 December 2008 - 08:38 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users