php - How can I keep the URL id on submit? -


when click submit, data submitted database url id of book disappears ----book.php

i want url go id of page e.g. ----book.php?id=3

is possible keep first line action="<?php echo htmlspecialchars($_server["php_self"]);?>" , add value="<?php echo $book_id ?>"?

<form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>">     <input type="hidden" value="<?php echo $book_id ?>" name="book_id" />     <p>author: <input type="text" value="<?php echo $_session['author']; ?>" name="author" id="author" readonly /></p>     <p>summary: <input type="text" name="summary" value="<?php echo $summary;?>" /></p>     <p><input type="submit" name="submit" value="submit" /></p>     <input type="hidden" name="submitted" value="true" />     </form> 

php code:

if (isset($_get['id'])) {     $book_id = $_get['id']; } 

please try code:

// save values in db  header('location: book.php?id=' . $book_id); exit; 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -