Get value from URL variable. PHP. The form uses POST method -
i save text textbox. want value of idforo in url.
http://localhost/foro1/indice.php?idforo=1 i error
notice: undefined index: idforo in c:\xampp\htdocs\foro1\indice.php on line 44 the controller
if (isset($_get['newanswer'])){ $idforo=$_post['idforo']; /*line 44*/ $newanswer=$_post['newanswer']; //save new answer using pdo header("location:indice.php?idforo=$idforo"); }
the form
<form method='post' action='indice.php'> <textarea rows='7' cols='60' name='newanswer' required></textarea> <br> <input type='submit' class='responder' value='responder' name='comentario'> </form> i appreciate help
to variables query string, need use $_get. $_post represents data sent script via http post method.
you're translating (?) post variable name textarea reason?
try:
if (isset($_post['nuevarespuesta'], $_get['idforo'])) { $idforo = $_get['idforo']; /*line 44*/ $newanswer = $_post['nuevarespuesta']; //save new answer using pdo header("location: indice.php?idforo=$idforo"); }
Comments
Post a Comment