Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you set a value on click thr

Status
Not open for further replies.

jerusalm

Technical User
Sep 30, 2002
3
IL
How do you set a value on click thru and pass it to a php script?
 
i prefer to set a hidden hmtl value and autosubmit a form to the php script Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
I have made links like:

[tt][/tt]

and then process in do_it.php as:

[tt]$_GET[variable][/tt]

...but I am curious about autosubmitting forms. Can you offer a sample Bastien? Can the form submit the value when a link is clicked on (even if a submit button is unavailable or not clicked on)?
 
use a javascript function to set a vairable using the onClick functions

<script language =&quot;javascript&quot;>
function myfunction(){
forms.someval.value=&quot;myvalue&quot;;
form.submit();
}
</script>
</head><body onLoad=&quot;myfunction();&quot;>
<form action=&quot;anotherpage.php&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;someval&quot;></form></body>

I use this a lot for error control whereby after checking the data submited by some other form I can tell the user in a friendly way that there is a problem...what I like to do is have the hidden variable set with some value that is placed by the validation code and then use the javascript to pop up an alert box to tell the user there is a problem and then when the user clicks the &quot;ok&quot; button, I redirect then back to the forms page to correct the error...

hth Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top