0

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>
Azim Ali
  • 1
  • 1
  • Could you please post action_page.php as well? This is likely because you have not specified the form method as POST. – remyp Apr 16 '15 at 21:00
  • We need your action_page.php code to see what's going on there. Also, what method are you intending on using? POST or GET? – Tango Bravo Apr 16 '15 at 21:00
  • I am actually unsure as to how to set up the action_page.php. I was looking at other sites as examples to hopefully get a better understanding. I've been reading up on the get method for this page would be "
    " . However I am unsure about this being new to HTML
    – Azim Ali Apr 16 '15 at 21:06
  • 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 – Azim Ali Apr 16 '15 at 21:12
  • You mention you're just starting out with HTML, so I'm not sure if you've gotten a proper PHP environment set up. Do you? – Narong Apr 16 '15 at 21:14
  • I do not have any PHP experience or even idea as to what I am doing. I'm just trying my best to see whats out there and how I could adapt that to my project. Thanks – Azim Ali Apr 16 '15 at 21:15
  • It's best to start out with basic HTML and perhaps move onto JavaScript. PHP is a backend technology and will require a PHP server. Again, I really recommend learning HTML and at least -some- JavaScript before you try to PHP. – Narong Apr 16 '15 at 21:16
  • Assuming that I do not have the time to read up on javascript and PHP. Can this be done using only html? – Azim Ali Apr 16 '15 at 21:17
  • Probably not. HTML is pretty static and can be made much more dynamic with the introduction of JS and PHP. What's the purpose of what you're building? You could probably find scripts already written. – Narong Apr 16 '15 at 21:20
  • Honestly we are creating a project for an embedded system class. We wanted to create an application that we could parse and pull information from. Unfortunately HTML is not part of the class so this is all self learning. What I really want to do is make the first webpage a control panel for a user where he can set his input. We then have our Mbed System parse the second HTML page and take the inputs and carry out whatever actions it needs to. Where would I find scripts like these? – Azim Ali Apr 16 '15 at 21:23
  • At the very least, you'll need JavaScript. http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript has some examples on how you can pull values from the URL. Good luck. – Narong Apr 16 '15 at 21:24
  • Thats one of the issues that I am trying to avoid. I can't pull the values from the URL. I need them to be saved and printed on a static HTML page. The methods I keep running into wouldn't allow me to keep checking a single webpage such as ip:8000 and keep checking for updates. How can I go about doing this? – Azim Ali Apr 16 '15 at 21:27
  • So you're looking for a way to enter some value into the first HTML page and have those values be saved into the second HTML page until you enter new values into the first page? If so, you're going to need some kind of backend to store those values. – Narong Apr 16 '15 at 21:30
  • `I can't pull the values from the URL. I need them to be saved and printed on a static HTML page.` It is _possible_ to do this but you need to write code that will run on the server. PHP code does run on the server. That said, writing out a new static html page is Not The Way To Do Things. Delving into what the right ways are is much too big a subject for a StackOverflow question & answer. – Stephen P Apr 16 '15 at 22:26

1 Answers1

1

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 !

Yann Chabot
  • 4,789
  • 3
  • 39
  • 56