I know this will be very basic for the majority of you, but I just dont find the information I need. I started today with HTML/PHP/JavaScript (no experience in any of those 3). My situation is that I have a html form with a input-field and this input field shall be saved to a php-session-variable. What I achieved is after pushing the submit button getting the variable in the following .php site and then store it in the session variable.
That is super ugly, isnt it? Its like throwing stones over a fence just to run around in the next moment and picking them up again. How can I directly save information into the session fields on a submit?
That IS the right way! You should throw information at server and let it save it into sessions!
Sessions are not accessible from client side, that's the fence you mentioned!
To be more accurate:
<form method="post" name="contact" action="">
<label for="author">author:</label>
<input type="text" id="author" name="author"/>
<input type="submit" value="submit" id="submit" name="submit"/>
</form>
if(isset($_POST['submit'])) //Stone found
session_start();
$_SESSION['their_place']=$_POST['author'];
Hope It Helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With