php - Passing parameter through "window.location.href" -


<!doctype html> <html>   <head>     <title>post answer</title>   </head>   <body>     <?php     include ("connection.php");        $result = mysqli_query($con, "select * student_table sid='$_post[sid]'") or die('query failed');       $tmp = mysqli_fetch_array($result);       $nn = $tmp['nickname'];       $a = $_post['answer'];       $sid = $tmp['sid'];       $c = $tmp['course'];       $q_id = $_post['q_id'];       $sql = mysqli_connect("127.0.0.1", "root", "", "project");       $sql = "insert answer_table (nickname, answer, sid, vote, course) values ('$nn', '$a', '$sid', '', '$c')";        if (!mysqli_query($con, $sql)) {         die('error: ' . mysqli_error($con));       }        echo ("<script language='javascript'>                 window.location.href='question.php';                 window.alert('thank you! answer online now.')                   </script>");     ?>   </body> </html> 

at "question.php" file, want receive "$q_id" "$_get['q_id'];"

can pass "$q_id" of line 17 "question.php" page of line 26?

just add in query string in javascript

echo ("<script language='javascript'>          window.location.href='question.php?q_id=$q_id';          window.alert('thank you! answer online now.')        </script>"); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -