Jump to content

Recommended Posts

I have a form that when processed produces a url of

/search.php?type=1&location=Special+Events

and when i say

<?php
foreach ($_GET as $key => $value){
	echo $key." :".$value;
}
?>

nothing is showing up.  Nor Can i access anything get anyway.  I've tried using post on it too, nothing I'm on 4.7 so I know the $_GET nomenclature isn't an issue, but I've stumped.

Link to comment
https://forums.phpfreaks.com/topic/72106-server-can-not-send-data-via-getpost/
Share on other sites

I'll show part of it as I'm embarrassed by its uglyness (I didn't write the original form), however its not the issue, because I can manually set get via typing a url.

<h4>Event Search</h4>
<form name="serach" method="get" action="<?php echo $_SERVER['php_self'];?>">
<input type="hidden" name="type" value="2" />
<br />Date (yyyy/mm/dd): 
			<input type="text" name="year" value="yyyy" size="4" />
			<input type="text" name="month" value="mm" size="2" />
			<input type="text" name="day" value="dd" size="2" />
<br /> <input type="submit" value="search" />
</form>

but you actually made me realize something interesting as its not actually processing as the $_SERVER is lower case I will try that

works as posted for me:

 

<?php
foreach ($_GET as $key => $value){
	echo $key." :".$value;
}
?>

<h4>Event Search</h4>
<form name="serach" method="get" action="<?php echo $_SERVER['php_self'];?>">
<input type="hidden" name="type" value="2" />
<br />Date (yyyy/mm/dd): 
			<input type="text" name="year" value="yyyy" size="4" />
			<input type="text" name="month" value="mm" size="2" />
			<input type="text" name="day" value="dd" size="2" />
<br /> <input type="submit" value="search" />
</form>

yeah its not my server, nor do i have access to adjust settings, but what I've come to the conclusion is this. Each page basically includes a skeleton layout that has the actual content area inside of it.  When I capitalized the PHP_SELF part of the server it processed it to the included file just the content, not the actual page that was being viewed.  That successfully showed the get variables.  So I tried to change it so it went right to the search page (The one with the layout and the form is included, however now it won't show get. I know its processing php as that is not the issue, but there is something funny with the server not processing forms to a page other than its self I think.

It just doesn't make sense to me how it can process to

 

/redesign/source/serach.php?type=2&location=Special+Events&year=yyyy&month=mm&day=dd

 

but not to

 

/redesign/search.php?type=2&location=Special+Events&year=yyyy&month=mm&day=dd

 

when the second url is the actual page the users visit, and the top is just the source code for the content section.  I'll have to talk to the person I am doing this for and see what their conclusion is.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.