+ 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']; ?>
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.
+ 3
your code is valid and will run on real server
+ 3
As I know there is one method to get input in SoloLearn's playground php code - get it from web
+ 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
+ 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
+ 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");
+ 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.
+ 1
I Think I Don't hijack other people's question. Use the search function instead.
0
so basically i cant get users to subscribe via sololearn?
0
it dont work either way on or off solo...?
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?
0
my code is in the question
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
0
I should be able to test it before it goes on the server shouldn't I ????
0
Try rapidphp editor
- 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....
- 1
How to create SIGN IN form that contain cookies using php? Anyone help me?