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
https://forums.phpfreaks.com/topic/29113-php-with-javascript/
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
https://forums.phpfreaks.com/topic/29113-php-with-javascript/#findComment-133465
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
https://forums.phpfreaks.com/topic/29113-php-with-javascript/#findComment-134713
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.