Pass value from a ahref to a textbox

M

Man-wai Chang

http://www.zshare.net/image/problem-png.html

I want to make the text on the left 2 columns clickable. When it's
clicked, the form will be POSTed and the code in the leftmost column
will be submitted as $_REQUEST['item_selected'].

How could I do that?

--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.21.1
^ ^ 18:59:01 up 17 days 3:52 1 user load average: 0.03 0.03 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
 
S

shimmyshack

http://www.zshare.net/image/problem-png.html

I want to make the text on the left 2 columns clickable. When it's
clicked, the form will be POSTed and the code in the leftmost column
will be submitted as $_REQUEST['item_selected'].

How could I do that?

--
.~. Might, Courage, Vision, SINCERITY.http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.21.1
^ ^ 18:59:01 up 17 days 3:52 1 user load average: 0.03 0.03 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

<script>
function submitnow(itemvalue)
{
document.getElementById('item_selected').value = itemvalue;
document.getElementById('myform').submit();
//will work if the form id is "myform"
}
</script>

<form id="myform" ....>
have a hidden input called
<input type="hidden" name="item_selected" />

make the text links and use
onclick="submitnow('B0001')"

you can access the posted value at $_POST['item_selected'] or
$_REQUEST['item_selected']
 
M

Man-wai Chang

function submitnow(itemvalue)
{
document.getElementById('item_selected').value = itemvalue;
document.getElementById('myform').submit();
//will work if the form id is "myform"
}
</script>

Thank you very much
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top