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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new to php : pass query string to same form

Status
Not open for further replies.

MrDontKnowNothing

Programmer
Jun 26, 2003
94
DE
hi folks,

i'm quite new to php, so don't wonder...

i do have a form with already got some data in the query string.

but when i try

<form action&quot;<?php echo &quot;thisdocument.php?&quot;.$GLOBALS['QUERY_STRING'];?> name=&quot;myform&quot; method=&quot;get&quot;>
...

i only receive the new data from myform in query string.
is there a way to pass the old query string without having a recursively growing query string?

can anyone help?

gracias!

alex
 
will you be overwriting the old query string with new values or the form input you're expecting separate from the values in the query string? If it were the latter, I'd suggest an easy way is to make a loop like this inside the form:

Code:
foreach($_GET as $k => $v)
  {
    echo '<input type=&quot;hidden&quot; name=&quot;' . $k . '&quot; value=&quot;' . $v . '&quot;>';
  }

This will take advantage of hidden fields. It seems you're passing to the form several stuff in succession. I'd suggest you use either sessions or cookies and use the POST method. The GET method will eventually run out. There's a maximum length to the query string.
 
alex,

You can also put the old query in (one or more) hidden fields in your form:

Code:
<INPUT TYPE=&quot;HIDDEN&quot; NAME=&quot;oldQuery&quot; VALUE=&quot;<? echo $GLOBALS['QUERY_STRING']; ?>&quot;>

Good Luck §;O)


Jakob
 
i tried your solutions before, but i do have an array in the query string and therefore aidz98'code doesn't work properly.

when using something like dkduge's code, a recursively growing querystring will result.

so i'll try to ask a better way:

what kind of mechanismns does php provide, without cookies, to pass data over more then one form?

mfg alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top