Mutley Posted September 3, 2008 Share Posted September 3, 2008 I have a function it contains the following form: *snip* <div> <div style="float:left"> <form enctype="multipart/form-data" action="loadout2.php" method="post"> <input type="hidden" name="goprodid" value="<?=$prod_id?>" /> <input type="hidden" name="goownid" value="<?=$own_id?>" /> <input type="hidden" name="gochkmarket" value="<?=$market_id?>" /> <select name="partoptions" style="width:50px"> <option name="select" value="0" selected="selected"> </option> <option name="gorepair" value="1" <? if($stock=='0'){?>disabled="disabled"<? }else{ echo"";}?>>Repair (-£<?=round($y)?>)</option> <option name="goreplace" value="2" <? if($stock=='0'){?>disabled="disabled"<? }else{ echo"";}?>>Replace (-£<?=round($price)?>)</option> <option name="gobin" value="3">Bin (+£3)</option> <option name="gomarket" value="4" <? if($loadout=='1'){?>disabled="disabled"<? }else{ echo"";}?>><? if($market_id == '1'){ echo "Remove off Market"; }else{ echo "Sell on Market";}?></option> </select> </div> <div> <input type="submit" name="gosubmit" value="Go!" style="width:30px; font-size:xx-small" /> <? if($market_id == '1') { echo " <img src=\"images/restrict_market.png\" style=\"vertical-align:top\" alt=\"On Market\" /> "; } else { echo ""; } ?> </div> </div> <? echo "</td> </tr>"; }// End No Items } echo "</table></form> <br />"; } The problem is, the form can be repeated several times on a single page. When it is submitted, it always refers to the first form on the page. I don't understand why as the form is ended with </form> on each one, so why does it think it's the same form everytime? Is there an easy fix to this? Thanks, Nick. Quote Link to comment https://forums.phpfreaks.com/topic/122598-form-in-function-that-is-repeated-not-working/ Share on other sites More sharing options...
Adam Posted September 3, 2008 Share Posted September 3, 2008 I assume your printing out the form in a loop? Well from what I can tell, although I cant see the start of the function, you seem to be printing </form> after the loop.. echo "</td> </tr>"; }// End No Items } echo "</table></form> <br />"; Try changing it to: echo "</form></td> </tr>"; }// End No Items } echo "</table> <br />"; Quote Link to comment https://forums.phpfreaks.com/topic/122598-form-in-function-that-is-repeated-not-working/#findComment-633015 Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2008 Share Posted September 3, 2008 You need to be more specific about what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/122598-form-in-function-that-is-repeated-not-working/#findComment-633210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.