Variable passing

How, if possible, can a $var be passed to the forms action php file?
I tried everything with no success.

You could use a hidden form field

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo 'hidden form field value: ' . $_POST['my_hidden_field'];
}

<form method="post">
    <input type="hidden" name="my_hidden_field" value="some_value">
    <button>Send</button>
</form>

Would need more details, but yes. You can use a hidden form field like mentioned, add it to the session array, or send it as part of the uri.

The OP solved this on a different forum, two days ago, about 3 hours after the time of the initial post.

Sponsor our Newsletter | Privacy Policy | Terms of Service