0

This question has already been asked in the forums but I think I need it dumbed down just a little further if someone is willing to help with that please as I'm fairly new to programming.

What I'm trying to achieve is to essentially fill out a HTML created form and have the responses display in certain places within a second templated HTML page.

Obviously the below is nothing what it should look like, but I've just mocked this up to give you an idea of what I mean.

In the form might be:

<form action="results.html" method="GET">
<input type="text" name="Title" />
<input type="submit" value="Submit" />
</form>

And I want the text that is entered to appear where the XXXXX in "results.html" is:

<table>
<tr>
<td>
<font face="trebuchet ms" size="2px" color="CBAB62">TITLE:</font>
<font face="trebuchet ms" size="2px" color="CBAB62">XXXXX</font>
</td>
</tr>
</table>

I've seen both PHP and JavaScript offered as solutions. As someone who has never touched either of these languages, could someone please advise which way I should be going to get my project across the line?

I don't have access to a web server so if its possible to do this entirely offline, that would be my preference but obviously I'm open to all suggestions and assistance offered.

Thank you all in advance.

birkh0ff
  • 17
  • 1
  • better to go with javascript – Edison Augusthy May 08 '19 at 14:25
  • Its not possible. HTML stands for Hypertext Markup Language. As you can read its "markup". So, only solution is to use non markup language. You can go with javascript but think twice. In that case you are sending data from client side to client side. What is the point of doing it? Its already on client side. – Filip Krstic May 08 '19 at 14:28
  • Thanks for the replies. Perhaps if I explain what my actual goal is, it might put things into perspective. I sell on eBay using the same template for the layout, theme colours, item specifics, description, etc. I've always gone into the HTML file and manually updated the text. I'm now at a point where I would like to outsource this to someone with no HTML skills whatsoever so was hoping to find a way to have them fill out a basic form and when they submit it, it populates all the information into where it needs to be in the template that will be used to create the listing. Will that work? – birkh0ff May 08 '19 at 14:29
  • 2
    Don't use ``. [It's obsolete](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/font). Use CSS. – j08691 May 08 '19 at 14:30
  • Note that the `` tag does not use and does not need a closing slash and never has in HTML. – Rob May 08 '19 at 14:45

2 Answers2

0

PHP would be a great way to grab this and echo it on the "results" page. However, you may want to check out this link: How to get the value from the GET parameters?

Which may help do this with just javascript...

Change the "results.html" to "results.php" and use the code shown on the "results.php" page.

<table>
<tr>
<td>
<font style="font-family:trebuchet ms; font-size:2px; color:#CBAB62;">TITLE:</font>
<font style="font-family:trebuchet ms; font-size:2px; color:#CBAB62;"><?php $id = $_GET['title']; echo $id;?></font>
</td>
</tr>
</table>
antivinegar
  • 437
  • 1
  • 8
  • 27
  • 1
    Thanks for your reply. I'm definitely open to all suggestions at this point so I'll have a read through and see if I can get my head around it. Thanks again. – birkh0ff May 08 '19 at 14:41
  • Thanks for providing that code, I'll give that a shot as well. Cheers. – birkh0ff May 08 '19 at 14:45
0

In order to provide a chunk of data to a web page, you'll need to store it somewhere for the second page to get it from. Typically, depending on the purpose and how long you need the data, you could use GET or POST to store it in a database table, a flat file, a session variable or a cookie.

The simplest solution without a web server might be sending it to the second page in the get request.

results.html?title=XXXXXX

ps. If you have a windows computer you can install WAMP to set up a local web server for testing & development. If you are on a Mac you already have a web server.

Mike Volmar
  • 1,927
  • 1
  • 22
  • 31
  • Thanks for your reply. That makes complete sense (that it will need to be stored somewhere first for the second file to retrieve the data from). I'm still trying to come up to speed with it all but I'll install WAMP (as I'm on Windows) and will see if this is a missing piece of the puzzle. Thanks again mate. – birkh0ff May 08 '19 at 14:43