login about faq


Hi All,

Was wondering if anyone knows of a script or way to have data entered into a text box added to an html string and return the result in a popup or the same page.

so take this for example

http://webmastertalk.com/images/(fill from text box).jpg

In the text box users could enter " 54321 "

and upon clicking a button the html link would change to:

http://webmastertalk.com/images/54321.jpg

and open the html link in a different window.

Thanks in advance =P

asked Dec 25 '10 at 01:52

Alty's gravatar image

Alty
28681017


Not sure about HTML but you could certainly do it using PHP and Ajax. The PHP script would just be a self submitting form and would submit into the url. For instance;

$link = "FORM HERE";

Then you would %_GET the form and the URL would be something like this;

echo "<a href='http://webmastertalk.com/images/$link.jpg'>Image:$link</a>";

The examples above a very rough but you get the idea.

Do a bit of research into PHP and Ajax and you'll be there in no time!

answered Dec 25 '10 at 06:57

Hugo's gravatar image

Hugo
1.7k243151

HTML doesn't do things like that, to my knowledge. It's a markup language, not a programming language. HTML5 changes that a bit, but that's really because of the tighter integration of javascript.

You could use javascript to evaluate the results of an html FORM data field, but it would still be JS doing the conditional logic.

answered Dec 26 '10 at 01:15

kcap122's gravatar image

kcap122
312

JavaScript that baby.

var a = document.getElementById("linkid");    
a.href = "http://hewlink.com";

Where linkid is the ID of your hyperlink <a> tag.

answered Dec 26 '10 at 01:37

tsilb's gravatar image

tsilb
21.0k65199333

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×142
×87
×56

Asked: Dec 25 '10 at 01:52

Seen: 1,855 times

Last updated: Dec 26 '10 at 01:37