+ 5
How to submit a simple HTML form and access html input element using PHP?
A cookie associated with a cross-site resource @http://solocode.azurewebsites.net/ was set without the "sameSite" attribute - it has been blocked as Chrome now only delivers cookies with cross-site requests if they are set with "sameSite=None" and "Secure"
3 ответов
+ 2
If you have POST method on your form, then you access the value of each input after submit in PHP with $_POST['name_of_input_element']
for example:
<?php
if(isset($_POST['username'])){
echo $_POST['username'] ;
}
<form method="POST">
<input type="text" name="username">
<input type="submit">
</form>
+ 2
Thanks for your response.. My question should have been why my submission cannot be set using either POST or GET methods.. When I look in the Chrome Developers Toolkit it says that my HTTP request was blocked due to cross-site request not set with "sameSite=None" and "Secure"..i'll make my code Public so you can see what I mean,, submit6.html and submit6.php
0
Make sure you have your method set. Its GET by default if you dont specify it i think :D
But are you sure you can access your two separate files? Like they can see each other? I am not sure about that. Try to put the whole HTML into the PHP file and try it then.