HTML form not sending data via $_POST [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have been trying to send some basic form information from my index page to a .php page without success. I have tweaked my code looking at the previously asked questions but to no avail.
I have another form on the same page which sends information to another .php page which works without flaw.
My form page code:
<form name="login" action="login.php" method="post">
<p>email: <input type="text" name="loginEmail"></p><br>
<p>password: <input type="password" name="loginPass"></p>
<button type="submit"> Submit!</button>
</form>
my login.php page code:
<?php
echo "test";
$email=$POST_["loginEmail"];
echo $email;
?>
All I see on my login.php page is "test".
Thanks.

Switching the location of the _ should do it:
<?php
echo "test";
$email=$_POST["loginEmail"];
echo $email;
?>

Related

isset($_POST['submit']) not being triggered on button click [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
The below code should echo when a user clicks on "more". I can't see the issue with the below code, so any assistance will be much appreciated.
if (isset($_POST['more'])){
echo <<<saveNewFactor
<input type="text" size="29">
saveNewFactor;
}
echo <<<saveNewFactor
</br>
<input type="submit" neme="more" value="more" class="forming7">
saveNewFactor;
In your HTML:
<input type="submit" neme="more" value="more" class="forming7">
You have spelt name as neme, change it to:
<input type="submit" name="more" value="more" class="forming7">

PHP - Variable from form not staying after refresh, or not appearing at all [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am testing PHP and the variable from the form is not staying, and does not appear even on the same page. Here is the code:
<?php
echo "<form action='input.php' method='post'>Test: <input type='text' name='last' </form><input type=submit>";
echo "<h1>The last input was: </h1>", $_POST["last"];
?>
This is not a PHP problem. It is an HTML problem.
Your submit button is outside of the form.
It's effectively "submitting" a blank, empty, made-up form of its own.
That made-up form does not contain any of your data.
Move the submit button to inside of the form.

Can someone fix my php echo statement? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
echo "Click Here";
Can someone please fix this? I keep getting errors and i really am confused...
I'm trying to make it so it echos a changed url using a form.
My form:
<body>
<h1>Enter Player Name.</h1>
<form method="post" action="handler.php">
<input type="text" name="player">
<input type="submit">
</form>
</body>
If you can, can you tell me how to make it so when the "Submit" button is pressed it auto redirects them in a new tab to the edited url? If you could, it would be amazing!
This should do the trick. When using quotation marks you can put the PHP variable direction inside the string. Then you can change the quotes around the url to single quotes so it doesn't close out of the string.
echo "<a href='http://bans.scavengercraft.com/index.php?action=viewplayer&player=$_POST[player]&server=0'>Click Here</a>";

Why is't my form working in php/html? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
im trying to pass a variable with a submit button and it doesn't work.
<FORM METHOD="LINK" ACTION=<?php echo "\"add_event.php?email=".$email."\""?>>
<INPUT TYPE="submit" VALUE="add event">
</FORM>
$email is fine in the page that's calling it.
http://localhost/aproject/add_event.php?
that is the url that's passed.
not
http://localhost/aproject/add_event.php?email=myemail#email.com
as I want.
Any thoughts are appreciated.
edit:
the generated html is
<form method="LINK" action="add_event.php?email=closeded#gmail.com">
<input type="submit" value="add event">
</form>
There is no such form method as LINK, so your form is using GET (the default).
When you submit a GET form, you will destroy any existing query string on the form action and replace it with one generated from the form data.
Use a hidden input to store your data instead.
<form action="add_event.php">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($email); ?>">
<input type="submit" VALUE="add event">
</form>

Get a reference that went on this page [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I need to get a reference that went on this page and then send it on the server.
I tried to add this field in my form
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
but I get nothing, when I try to go to my page from other pages using link, value of this input is empty.
What's wrong?
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
Echo it :
//here
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">

Categories