NoSalt Posted October 11, 2009 Share Posted October 11, 2009 Hello All I have what I thought was a very simple html form design; but, as it turns out, doesn't work. Here is what I have: <form name="deleteEvent" method="POST" action="./eventHandler.php"> <ul> <li><button type="submit" id="10">X</button>event ten</li><input type="hidden" name="eventID" value="10"> <li><button type="submit" id="36">X</button>event thirty six</li><input type="hidden" name="eventID" value="36"> <li><button type="submit" id="55">X</button>event fifty five</li><input type="hidden" name="eventID" value="55"> <li><button type="submit" id="40">X</button>event forty</li><input type="hidden" name="eventID" value="40"> <li><button type="submit" id="25">X</button>event twenty five</li><input type="hidden" name="eventID" value="25"> <li><button type="submit" id="13">X</button>event thirteen</li><input type="hidden" name="eventID" value="13"> <ul> <input type="hidden" name="deleteEvent" value="1"> <form> Every time I click on the delete button, the POST value that gets passed is always the very last id in the list; in this case the POST value passed will be "13", even if I click the delete button for "event ten", "event fifty five", "event twenty", etc. No matter which delete button I click, the POST value passed will always be the last one in the list. Can somebody tell me why this doesn't work and possibly how to fix it? Thank you all for reading. Have a good day/night. Quote Link to comment Share on other sites More sharing options...
NoSalt Posted October 11, 2009 Author Share Posted October 11, 2009 Well ... I figured that I would use the following method to get it to work: <ul> <li><form name="deleteEvent_10" method="POST" action="./eventHandler.php"><button type="submit" id="10">X</button>event ten<input type="hidden" name="eventID" value="10"><input type="hidden" name="deleteEvent" value="1"></form></li> <li><form name="deleteEvent_36" method="POST" action="./eventHandler.php"><button type="submit" id="36">X</button>event thirty six<input type="hidden" name="eventID" value="36"><input type="hidden" name="deleteEvent" value="1"></form></li> <li><form name="deleteEvent_55" method="POST" action="./eventHandler.php"><button type="submit" id="55">X</button>event fifty five<input type="hidden" name="eventID" value="55"><input type="hidden" name="deleteEvent" value="1"></form></li> <li><form name="deleteEvent_40" method="POST" action="./eventHandler.php"><button type="submit" id="40">X</button>event forty<input type="hidden" name="eventID" value="40"><input type="hidden" name="deleteEvent" value="1"></form></li> <li><form name="deleteEvent_25" method="POST" action="./eventHandler.php"><button type="submit" id="25">X</button>event twenty five<input type="hidden" name="eventID" value="25"><input type="hidden" name="deleteEvent" value="1"></form></li> <li><form name="deleteEvent_13" method="POST" action="./eventHandler.php"><button type="submit" id="13">X</button>event thirteen<input type="hidden" name="eventID" value="13"><input type="hidden" name="deleteEvent" value="1"></form></li> <ul> It may not be pretty or the best method - or it could be for all I know - but it works perfectly, just like I wanted. Have a good one. Quote Link to comment 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.