Why is't my form working in php/html? [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 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>

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">

HTML form not sending data via $_POST [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 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;
?>

Php Get and post function not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I make a simple app without any database in php .just simple post method when i write my input text field and submit it send me to another post and put that input data in that field where i want if work in xammp fine but on live server it show me nothing here is my codes.........
<form action='show.php' method='POST'>
<input type="text" size="30" value="Enter Your Course Code Like &nbsp
&nbsp 'CS101'..." name="text" >
<button name="submit"></button>
</form>
and my show.php code is
<?php
if(isset($_POST['submit'])){
$N = $_POST["text"];
echo ''.$N.'_movie';
}
?>
Where i am wrong?
add type <button name="submit" type="submit"></button>
Tip: Always specify the type attribute for a element. Different browsers use different default types for the element.
also remove name="submit"
You used html element button. It is good choice if you want to add any event with javascript. But if you need to send form normal with backend, you need to use
<input type="submit" value="send" />
OR
<button type="submit">send</button>
the type="submit" mark button as submit form button. You ommited the type so you created only button element.Equivalent for button is
<input type="button" value="Click me" onclick="msg()">
But button does'n invoke send form to the backend.
I think $_POST['submit'] is not set because it doesn't have a value.
Change:
<button name="submit"></button>
To:
<button name="submit" value="1">Submit</button>
Usually you would use a type="submit", then to set the button text you use value:
<input type="submit" value="Submit" />
And now $_POST["submit"] automatically has a value already.

HTML Form not submitting [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a form like follows:
<form action="" method="GET" data-ronsor-url="http://web-search.tk">
<input id="q">
<input type="submit" value="search">
</form>
But nothing is submitted.
if the form was at http://web-search.tk/?q=mysearch, when the form is submitted, the url is http://web-search.tk/?, why is this. It worked before.
Note: I will delete this question if I get more than 1 downvotes
You need to specify the form action and the name of the input (query) field (instead of, or in addition to, the id):
<form action="http://web-search.tk" method="GET">
<input name="q">
<input type="submit" value="search">
</form>
Try adding a name attribute to the form input:
<form action="" method="GET" data-ronsor-url="http://web-search.tk">
<input id="q" name="q">
<input type="submit" value="search">
</form>
I am not quite sure what are you trying to achieve but if you set the action attr = http://web-search.tk it performs the search at http://web-search.tk website.
You might be depending on some js if you wish to perform the search at your website, but again I'm not quite sure what's yor goal!
Good luck, hope it helps

how to show the hidden data from mysql database [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
<form name="form11" method="post" action="hpdata.php" enc type="multipart/form-data">
<input name="pro" id="pro" type="hidden" value= "CMS" />
<input name="piror" id="piror" type="hidden" value= "P1" />
<input name="stat" id="stat" type="hidden" value= "In Progress" />
<input type="submit" name="submit" id="submit" class="groovy button" value="...">
</form>
in this code I can't see the data
hidden attribute just use for hide item from the UI. but still you can acsess them after form is submitted using $_POST['id here'] (if form method is get you should get it through $_GET[])
the code you provided has nothing to do with mysql.
It is a html fragment. It contains hidden inputs. If you want to make them visible remove type="hidden".
But most likely there is a purpose why they are hidden. Often this is done to keep values for different form pages or to present the user with pretty values, but send easier to handle versions to the server. (e.g. dates can have different formats in different countrys, but its easier to just send them in a standardized form --> this one would be in a hidden input.)

Categories