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!

Using Query

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I make a query like index.html?action=main, that way i can redirect them into different places depending on the action query.
 
i don't understand *exactly* what you're looking for :
- how to pass a parameter to another page ?
then the method you use (url?paramname=paramvalue) is correct, just read the faqs for this forum for more details on it (esp, how to retrieve the passed value)
- how to build the query ?
either do it explicitely (<a href=&quot;url?paramname=paramvalue&quot;>link</a>)
or use a GET form (<form action=url method=get><input type=text name=paramname><input type=submit></form>, when clicked, will call url?paramname=paramvalue)
- something else ? then please try to re explain what you're looking for

 
It might be easier to make a javascript function with if/else statement...and depending on what the user chose then the appropiate action can take place...
Ex:

<script>
function choices() {
if(document.FORM.choice[0].checked) {
window.open(' }
if(document.FORM.choice[1].checked) {
window.open(' }
if(document.FORM.choice[2].checked) {
window.open(' }
}
</script>


The above script will open one page if index array [0] is selected, another page if array[1] is selected, another page for array[2]... I have not failed; I merely found 100,000 different ways of not succeding...
 
I'm looking for this:

if someone go to: index.html?action=main, it should redirect them to another page for example: I needto redirect them depend on the action param.
 
You don't tell us where on your page the users select the specific &quot;action param&quot;

But maybe this example (a selectbox) can help you ??

Try This:

<script language=&quot;javascript&quot;>

function openWindow(url)
{
window.open(url, 'windowname','toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, top=0, left=0, height=600, width=800');
}
</script>

<form name=&quot;MyForm&quot;>
<SELECT style=&quot;width:275px&quot; name=&quot;selectboxname&quot; SIZE=&quot;1&quot;>

<OPTION value=&quot;none&quot; selected>- Select a Link -</OPTION>
<OPTION style=&quot;color:#FF0000; background-color:#ffcc99&quot; VALUE=&quot;<OPTION style=&quot;color:green&quot; VALUE=&quot;<option value=&quot;&quot;>something goes <pre style=&quot;color:red&quot;>here</pre></option>
</SELECT><br><br>
<input type=&quot;submit&quot; value=&quot;go for it&quot; name=&quot;submit1&quot; ONCLICK=&quot;javascript:eek:penWindow(document.MyForm.selectboxname.options[document.MyForm.selectboxname.selectedIndex].value);&quot;>
</form>

Hope this helps,
Erik
 
so :
read the faqs on how to retrieve the passed value with javascript
then use guju's solution, it's the way to go

an easier and more logical solution would be to use a server side language, but it can be done in javascript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top