Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2> Passing data in the request</h2> <p>You could either embed it as a hidden field in your form, or add it your forms action URL</p> <pre><code> echo '&lt;input type="hidden" name="myVariable" value="'. htmlentities($myVariable).'"&gt;'; </code></pre> <p>or</p> <pre><code>echo '&lt;form method="POST" action="Page2.php?myVariable='. urlencode($myVariable).'"&gt;"; </code></pre> <p>Note this also illustrates the use of <a href="http://php.net/htmlentities" rel="noreferrer">htmlentities</a> and <a href="http://php.net/urlencode" rel="noreferrer">urlencode</a> when passing data around.</p> <h2> Passing data in the session</h2> <p>If the data doesn't need to be passed to the client side, then sessions may be more appropriate. Simply call <a href="http://php.net/session_start" rel="noreferrer">session_start()</a> at the start of each page, and you can get and set data into the $_SESSION array.</p> <h2>Security</h2> <p>Since you state your value is actually a filename, you need to be aware of the security ramifications. If the filename has arrived from the client side, assume the user has tampered with the value. Check it for validity! What happens when the user passes the path to an important system file, or a file under their control? Can your script be used to "probe" the server for files that do or do not exist?</p> <p>As you are clearly just getting started here, its worth reminding that this goes for any data which arrives in $_GET, $_POST or $_COOKIE - assume your worst enemy crafted the contents of those arrays, and code accordingly!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload