Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to create a html page that will accept inputs from one webpage then print out the user results on a seperate HTML page. So far I have this. When I go and check my action_page.php file nothing is being written into it. Is there anyway I can have my inputs print directly on a second HTML page and constantly updating? Also is there any way for an outside application to control or change the values that are shown on the second webpage?
So I guess a more clear description of what I am trying to do is on one page its accepts input A,B,C then on another html page that have the previous A,B,C values I would like to update the values with the new user submitted values. The second webpage needs to also be static in the sense that the first html page would be website.com/UserInput and the second html page would be website.com/PrintedUserInput. I hope that helps. Thanks
<html>
<body>
<form action="action_page.php">
Time:
<br>
<input type="number" name="Time" value="">
<br>
Temperature:
<br>
<input type="number" name="Temperature" value="">
<br>
Instant Brew:
<br>
<input type="number" name="InstantBrew" value="">
<br>
<br>
<input type="submit" value="Submit">
</form>
<p>If you click "Submit", the form-data will be sent to a page called "action_page.php".</p>
</body>
</html>
All you have to do, is put the "method" attribute to your form like this:
<form action="action_page.php" method="post">
You absolutely need a server side language then to print them out. Since you use your page with the PHP extension, I'm guessing you're using PHP. So then you can call them that way in your other page:
<html>
<body>
Time: <?= $_POST['Time'] ?>
<br>
Temperature: <?= $_POST['Temperature'] ?>
etc, where the name you put between your POST braces is the "name" attribute of your input. Note that name attribute is case sensitive
Hope it helped !
Related
Experts,
One small question.I have a JSP form page which has Text Area field.
I have a string contains 300 lines. When I paste the content in text area field, it accepting the content. but when i submit the form, page got stuck there only and not moving to servlet.
If i give less than 50/60 lines. its accepting and moving the content to servlet. Any pointers would help how to achieve getting this 300 lines of content to servlet from jsp.
Thanks
Please use method type post
<form action="TEST" method="post">
<textarea rows="11" cols="160" name="tt" ></textarea>
<input type="submit" value="okkk">
</form>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have form simple like this..
And this for code
<form action="aksi.php?opsi=edit&aksi=update" method="post">
<input name="cabangID" type="hidden" value="'.$row['id'].'"/>
<div class="form-group"><label>Image (link)</label><input type="text" class="form-control input-xlarge" name="image_cabang" value="'.$row['image'].'"/>
<img src="'.$row['image'].'" width="420" height="275">
</div>
</form>
Now, I want to improve code like this.. When I change Image link, preview image change automatically without page refresh..
What is the code that I can use? Thank You
Try this (change input field to http://i.stack.imgur.com/uUHMf.png for example and click 'Change' button):
function fnOC()
{
var oim,oin;
oim=document.getElementById('idImg');
oin=document.getElementById('idInput');
oim.src=oin.value;
}
<div class="form-group">
<label>Image (link)</label><input id='idInput' type="text" class="form-control input-xlarge" name="image_cabang" value='http://www.vemix.net/MorningGloryFlower.jpg'/>
<input type='button' value='Change' onclick='fnOC();'/>
<img id='idImg' src="http://www.vemix.net/MorningGloryFlower.jpg" width="420" height="275">
<!--http://i.stack.imgur.com/uUHMf.png-->
</div>
You can do like this:
<input type="text" oninput="update(this.value)">
<img id="image" />
<script>
function update(value) {
document.getElementById("image").src = value;
}
</script>
On input update function is called with one parameter - the value of input field then the value is assigned to attribute src of image.
Note that there is no validation, there is no communication with server (you can do it by AJAX) it is just an example of data binding.
You should propably learn JavaScript.
Closed. This question needs debugging details. It is not currently accepting answers.
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.
Closed 6 years ago.
Improve this question
Sorry for my spelling
Hi, im trying to make a website showing internet forfeit, so in mySQL database i put all my information then I print it on my web page, the the user click on the forfeit he wants, it brings him to an other page that shows all the forfeit informations... In the while(), I'm making unique form for each forfeit, then on the
The problem here is that the only form sumbitted is the last one created
include_once "DataBase/db.php";
if($internet->num_rows != 0){
while($rows = $internet->fetch_assoc()){
$nom = $rows["nom"];
$id = $rows["id"];
$tech = $rows["technologie"];
$telechargement = $rows["telechargement"];
$televersement = $rows["televersement"];
$utilisation = $rows["utilisation"];
$prix= $rows["prix"];
echo '
<form method="POST" action="Fournisseurs/Videotron.php" id="'.$id.'">
<div class="boxes">
<div class="[ price-option price-option--high ]">
<div class="price-option__detail">
<span class="price-option__cost">'.$nom.'<br>$'.$prix.'</span>
</div>
<input type="hidden" name="id" value="'.$id.'"></input>
<input type="hidden" name="nom" value="'.$nom.'"></input>
<input type="hidden" name="tech" value="'.$tech.'"></input>
<input type="hidden" name="telechargement" value="'.$telechargement.'"></input>
<input type="hidden" name="televersement" value="'.$televersement.'"></input>
<input type="hidden" name="utilisation" value="'.$utilisation.'"></input>
<input type="hidden" name="prix" value="'.$prix.'"></input>
<div class="price-option__purchase">
Submit
</div>
</div>
</div>
';
}
}
You can see what i'm talking about here : http://fournisseursquebec.com/Forfaits.php
just select internet
Thank you!
You are missing the closing </form> tag for every box. Now you have one big form with a lot of repeated fields:
<form method="POST" action="Fournisseurs/Videotron.php" id="'.$id.'">
box 1:
<input type="hidden" name="id" value="'.$id.'"></input>
.... box 2:
<input type="hidden" name="id" value="'.$id.'"></input>
...
The name attribute of the various input is the one that is sent and should be unique inside every form.
Just add the </form> tag in your while loop and it should work.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to add values to my MySql database using PHP. The values I want to add, will come from the text-boxes of a form. I tried $variable = $_POST['formElementName'] and used $variable to insert values. But it doesn't work.
Question:
How can I put the values of the text-boxes into variables?
Thanks.
Use below code for the form
<form name="form-name" action="" method="POST">
<input type="text" name="fieldname1" value="" />
<input type="text" name="fieldname2" value="" />
</form>
and for php manipulation at server end, you will get values in $_POST i.e.
$_POST['fieldname1'] and $_POST['fieldname2]
I just want to elaborate what #Kyle wrote
Note: The form method is POST
HTML part
<form action="your_php_file_name.php" method="POST">
<input type="text" name="first_name" />
<input type="submit" value="Submit" />
</form>
PHP part: The file name is: your_php_file_name.php
<?php
//A good practice to check the type of HTTP request
$fname = $_POST['first_name'];
?>
Some good practices
Check the HTTP request type sent from the client side. (I find it a good way)
Sanitize the variables before inserting.
Here's an idea:
Client-side:
<input type="text" name="first_name">
Server-side:
$var = $_POST["first_name"];
Just to add to Kyle's answer above, Make sure you have value="Something" set, otherwise it will return nothing.
<input type="text" name="first_name" value="Testing">
Server Side
$var = $_POST["first_name"];
For debugging I use:
print_r($_POST)
This will return all the POST values set and is really handy.
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
I have a HTML login form in my ASP.NET MVC application that looks like this:
<form action="/Account/Login" class="form" method="post">
<input name="UserName" size="25" type="text" value="">
<input name="Password" size="25" type="password">
<button type="submit" class="glossy">Login</button>
</form>
<div class="loading-mask" id="authenticating">
<span>Authenticating ...</span>
</div>
When the user clicks submit there is a delay before the /Account/Login action is processed and before it returns either with a partial form showing errors or before it takes the user to a new page.
Is there a way that I can make the loading div invisible when the form first appears and then have it become visible after the submit button is clicked. Note that I won't need it to be hidden again as any action after the submit will result in a fresh load of the page.
Note I am looking for some way that does not use jQuery.
Set the display property the to none at first.
#authenticating {
display:none;
}
And then in the form's code
onsubmit="document.getElementById('authenticating').style.display = 'block'"
EDIT
As Dave suggested, it is better to use event listeners.
document.getElementsByClassName('form').addEventListener("submit", function(){
document.getElementById("authenticating").style.display = "block";
}), false);