Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 9th, 2008, 08:41 AM
Registered User
Join Date: Jun 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default isset($_POST)

Why do we write the following code:

Old June 21st, 2008, 07:13 AM
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2005
Location: London, , United Kingdom.
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts

You mean isset($_POST['posted'])
The isset function is used to see if a variable has been declared, and is not NULL. If you try to use a variable which has not been declared PHP will generate a warning. See www.php.net/isset for a full description.

It is most often used to check that the input to the page ($_GET, $_POST, $_SESSION etc) has specific data set, for example if you have a page which is passed an ID in the querystring, you should check to see if the ID is present, so you can show your own error message or something.

  $productid = $_GET['id'];
  // ... use the id to show details ...
  print "Invalid Product ID";

Hope this helps

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using $_POST gkirk Beginning PHP 7 August 30th, 2006 07:21 AM
$_POST PROBLEM karlirvin PHP How-To 1 December 16th, 2005 03:14 AM
Getting nothing from $_POST['varName']; Kalisan Beginning PHP 10 February 3rd, 2005 02:37 PM
Getting nothing from $_POST['varName']; Kalisan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 January 26th, 2005 03:00 PM
isset natmaster C++ Programming 1 April 5th, 2004 09:18 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.