TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-11-2009, 08:56 PM   #1 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
slobrob is on a distinguished road
Default quick question

hi peoples,

i've just started to learn php and decided to buy PHP a beginners guide by vikram vaswani. only up to the section about if statements switch cases etc which i understand so far. However, in the exmaple given it has put in some code which i dont understand because it has never mentioned it before. can someone please explain it to me?

Thanks,
rob

PHP Code:
<?php 
//if form not yet submitted
//display form
If (!isset($_POST['submit'])) {
?>
slobrob is offline  
Reply With Quote
Old 07-11-2009, 09:12 PM   #2 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

$_POST is what is known as a superglobal and contains what is known as post data which is ordinarily sent via form submition.

isset is a function used to check if a variable has been set or not

In this case we're checking if a value has not been set for the $_POST['submit'] and if it's not preform the actions lying betwixt the brackets.
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 07-11-2009, 09:17 PM   #3 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
slobrob is on a distinguished road
Default

i know what $_POST means,it was the isset i didnt understand, i should have mentioned that sorry.

so just to clarify in this example i am reading, it contains a web form, so the isset checks to see if the submit button has a value, if it hasnt it will display the web form, if it has then it will process the form?
slobrob is offline  
Reply With Quote
Old 07-11-2009, 09:56 PM   #4 (permalink)
The Contributor
 
Normo's Avatar
 
Join Date: Oct 2008
Location: UK
Posts: 30
Thanks: 0
Normo is on a distinguished road
Default

Actually in this instance the if statement is checking to see if the variable is not set. So if the form has not been submitted then the form will be displayed. Similar to what you said but slightly different. :)

PHP Code:
if (isset($variable)) //if the variable is set
if (!isset($variable)) //if the variable isn't set 
Hope that helps :)

Edit: Yeah, sorry what you said, mis-read it.
Normo is offline  
Reply With Quote
Old 07-12-2009, 06:38 AM   #5 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

If I'm stuck with a function I Google something along the lines of "PHP Manual isset". Brings up the manual page for that function - got some very good examples for most the functions and has helped me out a great deal.

Good Luck
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 07-12-2009, 07:12 AM   #6 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

google links php to php manual so if you do php + <function name>.
it is the same as PHP Manual, just a tip :)

also if you google, php search toolbar for firefox,
there is many search toolbars for php :)
so you have php manual right in your browser....

-Cf
codefreek is offline  
Reply With Quote
Old 07-12-2009, 05:10 PM   #7 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Quote:
Originally Posted by codefreek View Post
google links php to php manual so if you do php + <function name>.
it is the same as PHP Manual, just a tip :)

also if you google, php search toolbar for firefox,
there is many search toolbars for php :)
so you have php manual right in your browser....

-Cf
No love for Google Chrome? (type php.net, press tab, enter your query)
__________________
My Site
adamdecaf is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Reply drewbee Feedback 2 03-18-2013 01:30 AM
Just a quick question.... frosty Absolute Beginners 4 08-19-2008 09:05 PM
quick question regarding c and php. masfenix General 6 07-10-2008 04:50 PM
Cleaning data before entering database question Killswitch General 7 12-24-2007 11:29 PM
Important Database Structure Question! AnthonyOS MySQL & Databases 5 12-20-2007 03:26 PM


All times are GMT. The time now is 07:42 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design