DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Get querystring (http://www.daniweb.com/forums/thread32497.html)

anthony05 Sep 17th, 2005 4:25 pm
Get querystring
 
Hello,

I've a question: I don’t know much, so please bare with me.

http://www.site.com/upload.html?dirname=abc
I want this querystring value (abc) into <input name="dirname">

<script type = "text/javascript" language = "Javascript">
<!-- Hide from older browsers;
{
var qPos = document.URL.indexOf('?');
dirname.value = document.URL.substr(qPos);
}
// end hide -->
</script>

I have tried with this code but unable to get the results.

[upload.html form]
<form ENCTYPE="multipart/form-data" method=post action="http:// www.site.com/cgi-bin/upload.cgi">
<td width=30% align=right><b><font face="arial" size=-1>Directory Name:</font></b></td>
<input name="dirname" size=30>
</font></td>
</tr>

Any Help Please?

cppforlife Sep 17th, 2005 8:46 pm
Re: Get querystring
 
To get input like you want you should use html and perl (or any other lang)

------some.html---------
....
<form method=get action='some.pl'>
<input type=text name=file value=text>
<input type=text name=file2 value=text2>
</from>
....

this makes some.html?file=text&file2=text2

-----some.pl------
....
$tempbuffer=$ENV{'QUERY_STRING'};    #reads file=test&file2=text2
....
#then you just split them up and do something


All times are GMT -4. The time now is 9:36 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC