mysql - Cannot receive post parameter using forms created by PHP echo -


i making webpage allows add friends. confirm part made confirm button made post redirect confirm page:

while($rs=$friendstoconfirm->fetch_row()) {     echo "friends $count confirm's id: $rs[0]";     echo "     <form name=\"confirm\" method=\"post\" action=\"confirmfriend.php\">     <input type=\"hidden\" name=\"userid\" value=\"$userid\">     <input type=\"hidden\" name=\"friendid\" value=\"$rs[0]\">     <input type=\"submit\" value=\"confirm\">     </form>     ";     echo "<br>";     $count++; } 

the $friendtoconfirm variable friends needed confirm , retrieved mysql. when hit button, expected receive userid , friendid confirmfriend.php, did not receive using $_post['userid'];. there way or doing wrong.

this because of forms have same name [confirm]. can try this:

$sl = 1; while($rs=$friendstoconfirm->fetch_row()) {     echo "friends $count confirm's id: $rs[0]";     echo "     <form name=\"confirm{$sl}\" method=\"post\" action=\"confirmfriend.php\">     <input type=\"hidden\" name=\"userid\" value=\"$userid\">     <input type=\"hidden\" name=\"friendid\" value=\"$rs[0]\">     <input type=\"submit\" value=\"confirm\">     </form>     ";     echo "<br>";     $count++;     $sl++; } 

hope work.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -