PHP:extend url with second form

Status
Not open for further replies.

heinzketchup

New Member
Messages
25
Reaction score
0
Points
0
ok, the problem:
i allready sent get data to the url.
url looks like this:
http://127.0.0.1/mypage/index.php?whatNext=manageContacts&action=Bestätigen

now, i have a second form that should also use get and not post! it should add this:
&find=company&findThis=a&findSubmit=Suchen

but everytime i try it deletes the old get information and adds the new info.

i thought that i need to say action="'.$_SERVER["REQUEST_URI"].'" but that also doesn't work!

sorry can't find a solution on the web and i also don't know what to search for!
 

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
Do this at the top of the page:

print_r($_SERVER);

This will give you all the variables stored in the array, you should then be able to build the next URL from that.

-Corey
 

heinzketchup

New Member
Messages
25
Reaction score
0
Points
0
i know! and better would be var_dump();...
but: i don't know where to put it! like i said, i tried it in <form method="get" action="<? echo $_SERVER["REQUEST_URI"] ?>">, it doesn't work. it replaces the old get information and doesn't add it at the end.
 

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
Sorry, I didn't fully read and understand your OP.

As far as I know you can't submit a form to a URL that already has GET variables in it. Have you seen this work somewhere else?

-Corey
 

heinzketchup

New Member
Messages
25
Reaction score
0
Points
0
well it is the same problem with post data... i found a solution where they put the get data into a hidden field. this was very useful for me. i could allready use this for linking back to the last page after deleting an entry, that has the advantage of a reload of the page.
--
example:

$lastPage=$_SERVER['REQUEST_URI'];
<input name="lastPage" type="hidden" value="'.$lastPage.'" />

?><script type="text/javascript">setTimeout("location.href='<? echo $lastPage; ?>'", 2000);</script><?

--
but my problem with this is that it doesn't save the post data from the last page. i can't use get because i allready used it and i don't know how to save the post data with a hidden field, because then i would only have a variable with all the post variables and how do i call them in this case...

do u have any ideas? i thought about sessions, but i think that isn't worth it!
 

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
You could continually use POST instead of get and just store the POST variables in all hidden fields. Anything that is spanning over multiple pages that needs to be stored should be done in SESSIONS though, they are very easy to use and sounds like it would be worth it in your case.
 
Status
Not open for further replies.
Top