homepage Welcome to WebmasterWorld Guest from 54.145.243.51
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
POST input
gonny

5+ Year Member



 
Msg#: 3699026 posted 5:07 pm on Jul 15, 2008 (gmt 0)

Hi all!

I want to show some content if is any $_POST[''] input.
Ex. index.php?show=page where $_POST is $_POST['show'] and I have many $_POST.
Now I want a case like:
if (!$_POST['*']) { $content="bla bla"; }

What can use * or '' blank into POST to mean there is any input?

 

dreamcatcher

WebmasterWorld Senior Member dreamcatcher us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3699026 posted 6:32 pm on Jul 15, 2008 (gmt 0)

Hi gonny,

I think you are getting comfused with your superglobals. $_POST is for POST data. In your example, 'show' is $_GET data.

if (!isset($_GET['show'])) { $content="bla bla"; }
if (isset($_GET['show']) && $_GET['show']!='page') { $content="bla bla"; }

etc etc

gonny

5+ Year Member



 
Msg#: 3699026 posted 6:56 pm on Jul 15, 2008 (gmt 0)

Thnx for replying me dreamcatcher: What I want is if exist a way to identify any $_GET or $_POST. $_GET['show'] identify "show" case only.

CDNQuilter

10+ Year Member



 
Msg#: 3699026 posted 8:10 pm on Jul 15, 2008 (gmt 0)

Rather than use a wild card character
if (!$_POST['*']) { $content="bla bla"; }

just test for the existence of the $_POST array:

if(isset($_POST) will return true if ANY $_POST variables is set

Similarly,
if(isset($_GET) )will return true if ANY $_GET variable is set.

dreamcatcher

WebmasterWorld Senior Member dreamcatcher us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3699026 posted 10:20 pm on Jul 15, 2008 (gmt 0)

Actually you should check that the arrays are empty, as they are set anyway by default.

if (!empty($_POST)) {
}
if (!empty($_GET)) {
}

dc

omoutop

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3699026 posted 7:02 am on Jul 16, 2008 (gmt 0)

if i get it right yo are asking something like:

$content = "";
foreach ($_POST as $key=>$value)
{
$content .= $key." = ".$value."<br>";
}
echo $content;

I hope i understand correctly what you are asking gonny

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved