homepage Welcome to WebmasterWorld Guest from 54.224.202.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
url with query string
rustyarmour




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

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




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

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




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

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




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

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]" ...)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved