Click to See Complete Forum and Search --> : Select from list link...


spykemitchell
09-24-2003, 12:17 PM
I expect this doesnot go in the PHP section but the script is in a php document and i have had problems with mixing javascript and php before...

I have experimented with the name function but it didn't seem to work...

Is there any way i can click on a link from a page i am making then it writes to the document saying you have selected this but doesn't actually take you anywhere, like a hidden input field that you can change the value of by a link and it writes what you have chosen to the page through the document.write function or whatever....

I hope that made sense...

If it's in the wrong section please move it...

Spyke.

pyro
09-24-2003, 12:38 PM
It doesn't really make much sense to me... Could you try re-explaining, please?

spykemitchell
09-24-2003, 12:46 PM
I have a row of links and a "hidden" Input in a form.

I want to change the value of the hidden input by clicking on one of the links so clicking on link one changes the value to A Link 2 changes it to B and so forth.

And once you have clicked on that link it changes the value of the the hidden input but also write an imge to the document to show what you have clicked...

does that make any more sense?

Nevermore
09-24-2003, 12:55 PM
You're right, that would be JavaScript not PHP. Exactly what do you want tho? (Third time lucky, lol):D

pyro
09-24-2003, 12:59 PM
This is a JavaScript question, but here's the answer:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Example</title>
</head>
<body>
<p><a href="#" onclick="document.forms[0].elements[0].value='One'; document.getElementById('mydiv').innerHTML = 'One'; return false;">One</a> |
<a href="#" onclick="document.forms[0].elements[0].value='Two'; document.getElementById('mydiv').innerHTML = 'Two'; return false;">Two</a> |
<a href="#" onclick="document.forms[0].elements[0].value='Three'; document.getElementById('mydiv').innerHTML = 'Three'; return false;">Three</a> | </p>
<form action="">
<input type="hidden">
</form>
<div id="mydiv"></div>
</body>

spykemitchell
09-24-2003, 01:13 PM
Thankyou that is what i wanted...

The nly reason i posted it here was i have had trouble using javascript in aphp documetn before, thats all...

Thankyou...

I was along those lines but not quite there...

Spyke.

pyro
09-24-2003, 01:27 PM
You're welcome... :)

spykemitchell
09-24-2003, 02:10 PM
I have got it to do what i want but how would i get it to out it in a certain input but not others if i have a form with multple inputs in it. I must all be in one form aswell.

pyro
09-24-2003, 02:27 PM
Give the form and input box a name, and then reference it like this:

document.formname.inputname.value

spykemitchell
09-24-2003, 02:33 PM
Yeah it was an easy question wasn't it. I figured it out shortly after i posted the question but thanks for your help anyway...

pyro
09-24-2003, 02:39 PM
You bet... :)