Connecting Tech Pros Worldwide Help | Site Map

Pass value from a ahref to a textbox

 
LinkBack Thread Tools Search this Thread
  #1  
Old May 15th, 2007, 11:05 AM
Man-wai Chang
Guest
 
Posts: n/a
Default Pass value from a ahref to a textbox


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

  #2  
Old May 15th, 2007, 12:15 PM
shimmyshack
Guest
 
Posts: n/a
Default Re: Pass value from a ahref to a textbox

On May 15, 11:59 am, Man-wai Chang <toylet.toy...@gmail.comwrote:
Quote:
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']

  #3  
Old May 16th, 2007, 02:05 AM
Man-wai Chang
Guest
 
Posts: n/a
Default Re: Pass value from a ahref to a textbox

<script>
Quote:
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

--
iTech Consulting Services Limited
Expert in ePOS (Point-Of-Sales) solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.