Bradley99 Posted June 25, 2012 Share Posted June 25, 2012 I have some code, in which I echo a form. From the form users pick different things. . . <? $showevent = mysql_query("SELECT * FROM fights WHERE event='$viewevent' ORDER by id ASC"); while($the=mysql_fetch_object($showevent)){ echo " <form action='' method='post'><tr><td class='profilerow'><input type=radio name=fighter_id value=$the->fighter1> $the->fighter1 <BR> <input type=radio name=fighter_id value=$the->fighter2> $the->fighter2 <BR> <input type=radio name=fighter_id value=1> Draw</td> <td class='profilerow'><select name=method><option value=KO>Knockout</option><option value=TKO>Technical Knockout</option><option value=DEC>Decision</option></select></td> <td class='profilerow'><select name=round><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></select></td> <td class='profilerow'><select name=bonus><option value=1>Yes</option><option value=2>No</option></td> <td class='profilerow'><input type='Submit' name='Submit' value='Pick' class='Submit' /> </td></form> </tr>"; } ?> When they choose 'Pick' for each fight, How can I, using INSERT INTO, insert the ID of that specific fight? As the fights are being echoed. I have Events table, Fights table & Fighters table. Aswell as the picks table that this info gets posted to. Quote Link to comment https://forums.phpfreaks.com/topic/264745-mysql-query-from-echo/ Share on other sites More sharing options...
zPlus Posted June 26, 2012 Share Posted June 26, 2012 It's actually difficult to understand your problem, as you've given no information on how your DB is designed. However as I see it, the simplest solution is probably to add a <input type="hidden" /> to your form, which is passed on when the form is submitted. Quote Link to comment https://forums.phpfreaks.com/topic/264745-mysql-query-from-echo/#findComment-1357076 Share on other sites More sharing options...
Bradley99 Posted June 26, 2012 Author Share Posted June 26, 2012 Yeah that's what I did in the end. Quote Link to comment https://forums.phpfreaks.com/topic/264745-mysql-query-from-echo/#findComment-1357109 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.