Welcome to WebmasterWorld Guest from 107.21.175.43

Forum Moderators: incrediBILL

Message Too Old, No Replies

url with query string

     

rustyarmour

9:00 pm on Dec 22, 2013 (gmt 0)

5+ Year Member



Hi All,

I have been combing the web for an answer to this one, but haven't been able to find it. I have a simple HTML form with 2 radio buttons on it. The button(s) when selected, should open a page on another website in a new browser window. Both links have a query string attached so the first drop down is preselected (so far so good, these both work). Both links also need to be appended with a second string of course using an "&", that will preselect the correct option in the next drop down field (option name=option value). I have checked the source code of the page to determine what the second value should be based on, but the appended query will not populate that second drop down using that information.

Any idea what I need to add to get the second value to populate?

function whichpage(form){
var page = form.elements.page, i = page.length;
while (--i > -1){
if(page[i].checked){
return page[i].value;
}
}
}
<form class="form" name="form" method="get" onSubmit="window.open(whichpage(this), '_blank'); return false;">


Any help would be appreciated.

lucy24

9:47 pm on Dec 22, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



It might help if you showed the code that populates the query string, as well as the code that reads its value. Are both parts of the query reaching the destination page? The first question is whether the query is getting lost, or just not being used.

This question might do better in the php subforum, since a query is almost by definition not an html issue.

rustyarmour

10:24 pm on Dec 22, 2013 (gmt 0)

5+ Year Member



Hi Lucy,

Thanks for the reply. I wasn't exactly sure where to post this since my form is simple html but loads an aspx page. Can I sticky mail you the code?

lucy24

11:47 pm on Dec 22, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Better to post it here, because if it is a php/asp/jsp/etcetera question, I will not know the answer :)

The first step is to break the problem into its step-by-step pieces:

does the form send the intended parameters?
does the destination page receive them?
does the destination page use the parameters it receives?

You can probably do some crude-and-simple tests to work out this part. Or at least some of it. (When all else fails, "echo name-of-value", or equivalent in language of your choice, and see what turns up. Only in local testing, obviously. But if you're expecting "7" and instead you get "" or "1, abc, 3" or "foobar" or "[array]" ...)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month