Jump to content

PHP with javascript


brown2005

Recommended Posts

Hi, What I want is say that i have this form

<form method='post' action='2.php'>
<input type='text' name='Item'>
<input type='text' name='Item_value'>
</form>

The i have a php page on the right that list say the players

Item 1 (4.5 Point)
Item 2 (6.5 Point)

What I want is say when they click on Item 1 link it puts Item 1 in the player input and 4.5 in Item_value..

ne help please
Link to comment
Share on other sites

That is pure javascript, look at this:
[code]

<a onclick="javascript: document.getElementById('Item').value='insert this'">Click 1</a>
<a onclick="javascript: document.getElementById('Item_value').value='insert this in the other'">Click 2</a>

<form method='post' action='2.php'>
<input type='text' name='Item' id='Item'>
<input type='text' name='Item_value' id='Item_value'>
</form>

[/code]
Link to comment
Share on other sites

cool, but can you have it do two things..

i mean when u click on link 1 can u have it enter 1 thing in box Item and another in Item_Value

i just tried

<a onclick="javascript: document.getElementById('Item').value='insert this'; document.getElementById('Item_value').value='insert this'">Click 1</a>

and it works, but is that the best way of doing it?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.