[FX.php List] $_GET won't GIT

Joel Shapiro jsfmp at earthlink.net
Thu Jan 17 19:53:47 MST 2008


On Jan 17, 2008, at 6:23 PM, Jonathan Schwartz wrote:
> There's also $PHP_SELF.
>
> But on a recent go around on this subject, ggt  suggested using  
> action="".  I'm guessing that it default to same page...and it has  
> worked fine.

... Until now ;-)

If you really don't want to change the action="" to  
action="page.php", you should be able to test for whether or not the  
form has been submitted -- via the name & value inside the <input...>  
part of the form -- instead of testing whether or not the $_GET &/or  
$_POST variables have been set, e.g.:

~~~~~~
<form....

// input fields here

<input type="submit" name="submission" value="continue">
~~~~~~

then in the processing at the top of the page, you could check  
whether or not "submission" was submitted with the value "continue",  
such as:

~~~~~~
if ($_POST['submission'] == 'continue' ) {
	// reached page via submitting the "submission" button
	// (that had a value of, and was labeled, "continue")
} else {
	// reached page some other way ($_GET, bookmarked...)
}
~~~~~~

I'm guessing that ggt's suggestion was to help keep the form easily  
re-usable on multiple pages/sites (what's the term for this? not  
"modular"?), but if you know that this form will *always* go to just  
that one page, I'd recommend hard-coding it.

HTH,
-Joel


>
> J
>
>
>
>
>
> At 6:16 PM -0800 1/17/08, Joel Shapiro wrote:
>> hmm... I don't know ggt's suggestion (I expect I may soon learn)
>>
>> Where/how do you specify the page that the form submits to?  I  
>> place that in the action="page.php" part, either hard-coded or as  
>> a variable, such as:
>>
>> echo '<form method="post" action="page.php" name="form">';
>>  or
>> echo '<form method="post" action="'.$url.'" name="form">';
>>  or
>> echo '<form method="post" action="'.$_SERVER['REQUEST_URI'].'"  
>> name="form">';
>>
>>
>> -Joel
>>
>>
>>
>> On Jan 17, 2008, at 6:06 PM, Jonathan Schwartz wrote:
>>
>>> Joel,
>>>
>>> Answer #1: (Per ggt's suggestion a while back)
>>>
>>> <form action="" method="post">
>>>
>>> Answer #2:
>>> Why Yes, the URL *does* contains the original GET parameters that  
>>> arrived with the GET page once the FORM has been submitted. That  
>>> explains why the data is ending up in GET at the same time as The  
>>> POST data is being collected.
>>>
>>> Do I need to manually unset it?
>>>
>>>
>>> J
>>>
>>>
>>> At 5:46 PM -0800 1/17/08, Joel Shapiro wrote:
>>>> Hey Jonathan
>>>>
>>>> One thought: What are you using as the page in your <form  
>>>> action="....?  Are you creatiing the page name dynamically (such  
>>>> as w/ a flavor of $_SERVER['REQUEST_URI'] -- which could include  
>>>> your GET data), or do you have the page name hardcoded (e.g.  
>>>> action="page.php")?
>>>>
>>>> Once the page has been submitted via the form/submit, does your  
>>>> url contain the GET data?
>>>>
>>>> -Joel
>>>
>>> --
>>> Jonathan Schwartz
>>> Exit 445 Group
>>> jonathan at exit445.com
>>> http://www.exit445.com
>>> 415-381-1852
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> -- 
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-381-1852
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list