+ 4

php submitting info

trying to collect user data for subscribe page and its not showing up in the foo.php file i have...heres the code if someone can please help this is super important!!!!!!!!!!! <form action="foo.php" method="post"> Name: <input type="text" name="username" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" name="submit" value="Submit me!" /> </form> <?php echo $_POST['username']; echo $_REQUEST['username']; ?>

17th May 2018, 8:15 PM
David CHAMPION
David CHAMPION - avatar
17 Respuestas
+ 4
I think, you try to run this code in SoloLearn playground. Your code is valid, if it in the foo.php file. Unfortunatly, in SL playground all runs php files named source.php in the some temporary directory. So you can not see a valid work of your code in SL playground.
17th May 2018, 8:40 PM
Dmitriy
Dmitriy - avatar
+ 3
your code is valid and will run on real server
17th May 2018, 8:52 PM
Dmitriy
Dmitriy - avatar
+ 3
As I know there is one method to get input in SoloLearn's playground php code - get it from web
17th May 2018, 9:18 PM
Dmitriy
Dmitriy - avatar
+ 2
in SoloLearn playground your php code runs one time and form data cannot be received. incert a reference to your code in a comment and I'll try to help more useful
17th May 2018, 8:50 PM
Dmitriy
Dmitriy - avatar
+ 2
David Woods have you designated yoursite.com/?foo.php or something like that to establish not only where to send but to retrieve the foo.php file I was just thinking as the form itself is good but possibly not connecting to a designated location. By the way don't forget to robot.txt noindex the foo.php
18th May 2018, 2:29 AM
BroFar
BroFar - avatar
+ 1
You can test it on local server(just install appache with php) or you can emulate users enter, by adding something like this: <?php $_REQUEST["username"] = ($_POST["username"]="testuser"); $_REQUEST["email"] = ($_POST["email"]="testuser@example.com");
17th May 2018, 9:13 PM
Dmitriy
Dmitriy - avatar
+ 1
David Woods What do you mean open foo.php? The contents of the POST request isn't going to be in the file. The foo.php simply processes the information.
18th May 2018, 5:03 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
I Think I Don't hijack other people's question. Use the search function instead.
28th May 2018, 1:36 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
0
so basically i cant get users to subscribe via sololearn?
17th May 2018, 8:41 PM
David CHAMPION
David CHAMPION - avatar
0
it dont work either way on or off solo...?
17th May 2018, 8:42 PM
David CHAMPION
David CHAMPION - avatar
0
I need to know why its not working off sololearn I am trying to implement into a site i am building, Can someone help with this please?
17th May 2018, 8:46 PM
David CHAMPION
David CHAMPION - avatar
0
my code is in the question
17th May 2018, 8:50 PM
David CHAMPION
David CHAMPION - avatar
0
<form action="foo.php" method="post"> Name: <input type="text" name="username" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" name="submit" value="Submit me!" /> </form> <?php echo $_POST['username']; echo $_REQUEST['username']; ?> im not getting any error when i hit the submit button it goes to a blank white webpage but when i open the "foo.php" file no info is submitted
17th May 2018, 8:51 PM
David CHAMPION
David CHAMPION - avatar
0
I should be able to test it before it goes on the server shouldn't I ????
17th May 2018, 8:58 PM
David CHAMPION
David CHAMPION - avatar
0
Try rapidphp editor
30th Oct 2020, 10:36 AM
Cleen
Cleen - avatar
- 1
I am trying it on my local using xampp i have it saved in the htdocs and everything...It dont echo the inserted info....
17th May 2018, 9:59 PM
David CHAMPION
David CHAMPION - avatar
- 1
How to create SIGN IN form that contain cookies using php? Anyone help me?
26th May 2018, 6:29 AM
I Think I
I Think I - avatar