LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-23-2006, 10:47 PM   #1
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
PHP question


I've programmed in C++, exclusivly in the CLI. When you write a PHP program, does the web browser act like the CLI? Or is there something else you need to do to get user input(strings, etc.)?
 
Old 01-24-2006, 01:35 AM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 68
Well, there is a cli version of php, but if you are using the apache module through a web interface you will need to use html forms to get user input to the program.

You can also use the url itself to pass variables to php:
Code:
http://example.com/somepage.php?foo=1&bar=2&baz=3
Please do keep in mind the security implications of this, and scrub any input very carefully.

Last edited by bulliver; 01-24-2006 at 01:38 AM.
 
Old 01-24-2006, 05:01 AM   #3
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
The php intepreter does all its work on the webserver and the output is sent as html to the web browser.
 
Old 01-24-2006, 07:29 AM   #4
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
Output (ie print and echo statements, and anything outside the <? ?> tags) is given directly the the web server.
Input is handled via a set of global array variables. The main ones you'll see are called $_POST[], $_GET[] and $_REQUEST[]. These are initialised when the script starts, and contain the data that was sent by the web user via the web form or the get request variables in the URL, etc. You may also come across $_FILES[], $_SERVER[], $_SESSION and $_COOKIES[]; the names are fairly self explanatory.


Hope that helps
 
Old 01-24-2006, 05:25 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
You may find it handy to bookmark this, if you haven't already: http://www.php.net/manual/en/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP / VideoLAN / Fedora Core Question - how can I get the PHP "exec" function to work gtrawoger Linux - Software 3 12-21-2005 06:51 AM
PHP Question Hockeyfan Programming 3 08-01-2004 01:10 AM
php question thar Linux - Software 1 06-02-2004 06:20 PM
PHP question guild Programming 2 09-30-2003 09:31 PM
php question sopiaz57 Linux - Software 3 07-22-2003 09:43 AM


All times are GMT -5. The time now is 07:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration