How to send get data with form | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to send get data with form

Hi, i want to send data with the form but the data cannot be fillen in a input field. And i dont want to use a session. I tried: <form action="index.php?dir=./location"> <input type="text" name="fileName"> </form>

16th Dec 2018, 3:01 PM
Arne Van Kerckvoorde
Arne Van Kerckvoorde - avatar
7 Answers
+ 3
you can use POST or GET create two files, htmlfile.html and phpfile.php paste these codes where u have its extension and run you will be able post data from a form htmlfile.html <form method="post" action="phpfile.php"> <input name="myname"> </form> phpfile.php <?php $name = $_POST["myname"]; echo $name; ?>
17th Dec 2018, 2:27 AM
Sampson Joshua (Jozy)
Sampson Joshua (Jozy) - avatar
+ 3
Sending data with forms is a server side action, your code looks ok except the fact that it does not have a post method hence the server does not know how to process it. <form action="file1.php" method="POST"> </form> Note: The method VERB must be POST, and when receiving it should be GET. I hope this helps. Regards...
1st Jan 2019, 9:11 AM
africana
africana - avatar
+ 1
Clement Benjamin you could use python to create a webserver with the http.server module and handle requests, or you could upload your files to a webhost (some free examples are 000WebHost and GithubPages (GithubPages doesn't support server-side script, but 000webhost supports php), with both of them you'll have a domain like: something.000webhostapp.com or something.github.io)
29th Dec 2018, 8:13 PM
Azad Ad
Azad Ad - avatar
0
I don't quite get the question. Do you mean this: <input type="hidden" name="fileName"> Input is not shown but exists.
16th Dec 2018, 3:06 PM
Niush
Niush - avatar
0
<form action="something.php" method="GET"> <!-- a few inputs and whatever you want --> </from> i believe this would do it
16th Dec 2018, 3:36 PM
Azad Ad
Azad Ad - avatar
0
After designing a web how do you put it on the internet
29th Dec 2018, 6:42 PM
Clement Benjamin
Clement Benjamin - avatar
0
Thanks
31st Dec 2018, 12:11 AM
Clement Benjamin
Clement Benjamin - avatar