Page 1 of 1

URL Variables and forms

Posted: Wed Feb 18, 2004 6:57 pm
by John Cartwright
I have NO IDEA how to do this. Absolutely none. THe problem is that I use the url to determine which pages are going to be displayed.

My index.php has a set of variable checks which will load my admin.php withen itself if p=4 is in the url. Inside admin.php if a=3 is set this form is loaded up. So the page with the form is at index.php?p=4&a=3

Here is where to problem comes into play. The form action is set to itself (admin.php) How am I supposed to keep those variables set while have the action set to admin.php ( admin.php has checks too for information submitted in the form ) So the form is simply reloaded inside admin.php awhile admin.php is still in index.php while admin.php still does the checks after the form has been processed. :S sorry bit complicated.

If you need more clarification just ask

Ty

Edit - I tried changing the form action to this

Code: Select all

<?php
        echo "</font><form action="index.php?p=4&a=3&"\n".  

?>
but after the form is submitted is goes to index.php and all the form values.. ( not keeping the p=4&a=3& variables

Posted: Wed Feb 18, 2004 8:44 pm
by dull1554
i think i know what your getting at,
so in admin. php you have something like this

Code: Select all

if(isset($_GET['a']))
{
if($_GET['a'] == "3")
{
//what you need to do is have this
if(!isset($_POST['submit']))//i'm assuming your form is using POST, if not change it
{
//here is where you put your form code
}
else
{
//here is where you put the code to parse the form
}
}
}

}
else
{
//here is where you have the links to the different admin sections
}
i hopes this helps you, if i misunderstood you just let me know and ill do my best to help you......

Posted: Wed Feb 18, 2004 9:08 pm
by John Cartwright
okay let me just show you

INDEX.PHP ? P=4
index.php loads up admin.php (p=4) in the middle of index.php
ADMIN.PHP ? A=3
admin.php loads up a form inside admin.php

So now you got index.php?p=4&a=3

My admin.php is setup like this

Code: Select all

if a==3 then

show form etc etc

close if statement
then

Code: Select all

if form is submitted set open window admin_confirm.php with all the variables set in there
admin_confirm.php is what adds everything to the database.

Now what is happening is that my action in the form is set to index.php?p=4&a=3&

but it is bringing me to index.php?opponent=df&league=cal&date=df&map=de_dust2&outcome=win&submitrecord=SUBMIT ( notice there is no p=4&a=3 ) in the same window ... but the popup is working perfectly, all i want is to keep in on p=4&a=3

Posted: Wed Feb 18, 2004 10:14 pm
by John Cartwright
up

Posted: Wed Feb 18, 2004 10:17 pm
by d3ad1ysp0rk
<form action="index.php" method="get">
<input type="hidden" name="p" value="4" />
<input type="hidden" name="a" value="3" />
</form>

Posted: Wed Feb 18, 2004 10:36 pm
by John Cartwright
for some reason the p=3 isnt showing up only a

Posted: Thu Feb 19, 2004 9:44 am
by John Cartwright
for some reason the first hidden variable was not being picked up so I added a 3rd one with the same values as the first one and it works fine