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.)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
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
Here I have 10 input field. Then when the user click submit button I want the only input field that have been modify send to database and update rather than all input field sent to the database.
How can I achieve it?
If you need to save the fields that the user touched, see the first variant. But a downside is that if the user changed the filed "abc" to "xyz" and then changed it to "abc", then the field will be marked as changed. If this is not what you want, then see the next variant.
(1)
You can use onchange() event in your field to set a variable when the field is modified. Then send these variables to the server using input hidden fields. Like this:
<input type='text' name='input1' onchange="getElementsByName('input1changed')[0].value = 1;">
<input type='text' name='input2' onchange="getElementsByName('input2changed')[0].value = 1;">
<input type='hidden' name='input1changed' value=0>
<input type='hidden' name='input2changed' value=0>
Then in your PHP code:
if ($_POST['input1changed'])
store $_POST['input1']
if ($_POST['input2changed'])
store $_POST['input2']
(2)
<input type='hidden' name='input1old' value='sometext1'>
<input type='text' name='input1' value='sometext1'>
<input type='hidden' name='input2old' value='sometext2'>
<input type='text' name='input1' value='sometext2'>
and in PHP:
if ($_POST['input1old'] != $_POST['input1'])
store $_POST['input1']
if ($_POST['input2old'] != $_POST['input2'])
store $_POST['input2']
You can compare the 2 arrays.
The first one is the data you loaded on the website and the second one the $_POST array.
You can check in your php if the input is set and write a query accordingly.
if(isset($_POST['name'])){
<!-- query -->
}
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
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
what I want to do is start a php session for the username, right after the form so it brings up the username once the user has pressed submit.
Here's the code for the form I have:
<form name="login" method="post">
<input type="text" name="username" placeholder="Username"/>
<input type="submit" name="login" value="Login" />
</form>
What do I do after that? Thanks.
Here is a simplified way; put this on top of the page (above) the html code:
if (isset($_POST['login']) {
session_start();
$_SESSION['name'] = $_POST['name'];
}
Now use that new Session variable where you need as the username. If you close your browser. It's no longer stored. (Unless you set a cookie.)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
When pressing send on my contact page (www.mainmanfilms.com/contact.html) I am sent to my contact-form-handler.php page that requires the visitor to re-type their information. Is there a way to may it one-fluid step? Ideally, they press send and receive my thank-you message. Anything you can offer is appreciated.
Yes. You can leave the action attribute empty and configure the form to POST to itself.
Normally, you'd do something like this:
<form action="contact-form-handler.php" method="post">
If you want to process the form and display the output in the same page, you need to make the following change (note the action attribute being empty:
<form action="" method="post">
An example:
<?php
if (isset($_POST['formsubmit'])) {
//form was submitted, do other stuff
echo $_POST['username']; //example
}
?>
<form action="" method="post">
<input type="text" name="username" />
<input type="submit" name="formsubmit" />
</form>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
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
Improve this question
I have a php form with dynamic checkboxes. It must connect to sql server and get their count and names. At the end I want submit the checked boxes.
example
I get from db some vegetables, for a receipt, and add checkboxes in my form. The user will check some of the and submit it.
I can't make <input type=checkbox id=...> because when post it i will not know the names of them. For that reason, i made a js function and when a checkbox checked, i add it to a array.
Now i want ask you, how i can submit this array and after that get the values at post.php file?
Create your checkboxes like:
<input type="checkbox" name="veg[]" value="tomato">
<input type="checkbox" name="veg[]" value="lettuce">
<input type="checkbox" name="veg[]" value="carrot">
<input type="checkbox" name="veg[]" value="celery">
Even if you don't know the names, you can iterate through the checkbox using:
<?PHP
foreach($_POST["veg"] as $veg){
echo $veg;
}
?>
Have you added name attributes to your checkboxes? Like so:
<input type="checkbox" name="potatoes" />