Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

Rep: Reputation: 48
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, 02:35 AM   #2
Senior Member
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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:
Please do keep in mind the security implications of this, and scrub any input very carefully.

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

Rep: Reputation: 75
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, 08:29 AM   #4
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, 06:25 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
You may find it handy to bookmark this, if you haven't already:


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 07:51 AM
PHP Question Hockeyfan Programming 3 08-01-2004 02:10 AM
php question thar Linux - Software 1 06-02-2004 07:20 PM
PHP question guild Programming 2 09-30-2003 10:31 PM
php question sopiaz57 Linux - Software 3 07-22-2003 10:43 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 AM.

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