RE: [PHP] Self Submitting Form
| From: | Sam Masiello | Date: | Sat, 21 Feb 2004 06:51:05 +0000 |
| Subject: | RE: [PHP] Self Submitting Form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178432@lists.php.net to get a copy of this message | ||
Hi Toby!
Thank you for your suggestion, but unfortunately you are using GET in your test2.html file. I
specifically stated in my initial email that due to the fact that I am using textareas in my
original form (your test1.html) that I did not want to use GET for it might run the risk of
overstepping the bounds of how many characters the browser will accept in the GET string.
Any other suggestions that anyone else has would be most appreciated as I am still pretty stuck on
this.
As always, thanks in advance!
--Sam
________________________________
From: Toby Irmer [mailto:php@irmer.com]
Sent: Fri 2/20/2004 6:07 PM
To: Sam Masiello
Cc: php-general@lists.php.net
Subject: Re: [PHP] Self Submitting Form
Hi Sam,
I am not sure I know what you want to do...
I tried to recreate your problem:
test.html
<form name="myform1" method="get" action="">
<input type="hidden" name="myvar1" value="testing">
<script>
window.open("test2.html", "test");
</script>
</form>
test2.html
<BODY onLoad="document.forms[0].submit();">
<form name="myform1" method="get" action="test3.html">
<INPUT TYPE="hidden" NAME="do_preview" VALUE="1">
<script>
document.write('<INPUT TYPE="hidden" NAME="itworks"
VALUE="'+opener.myform1.myvar1.value+'">');
</script>
</FORM>
</BODY>
test3.html
<script language="Javascript">
function parseQueryString (str)
{
str = str ? str : location.search;
var query = str.charAt(0) == '?' ? str.substring(1) : str;
var args = new Object();
if (query)
{
var fields = query.split('&');
for (var f = 0; f < fields.length; f++)
{
var field = fields[f].split('=');
args[unescape(field[0].replace(/\+/g, ' '))] =
unescape(field[1].replace(/\+/g, ' '));
}
}
return args;
}
var args = parseQueryString ();
for (var arg in args)
{
document.write(arg + ': ' + args[arg] + '<BR>');
}
</script>
And the output is:
do_preview: 1
itworks: testing
As should be expected...
Pls try to specify your problem.
toby