JSP Hosting
 

HostingServicesSupportOrderAbout UsSoftwareHome


Even experts read the manuals. Our tech support staff has most of the books that are out on a wide variety of web topics. Here are some of their top picks. We think you'll find them useful and informative as well.



PHP input

PHP pages can handle input from forms and URL query strings almost transparently. Simply prepend a $ symbol to the name of the variable passed to the PHP page. For a GET method example, if you retrieve a page with the following URL:

http://yourdomain.com/test.php?myvariable=value

then you can use the following code to print the variable to the screen:

The value of variable is <?echo $variable ?>

The exact same code works for data submitted with a POST form.

Unlike strongly-typed languages like Java and C++, PHP does not require explicit type definitions of variables. Therefore, the same variable containing numerical can be printed as text and also used in mathematical calculations with no need for conversions.

if - then - else statements

PHP also supports if - then - else constructs to create more sophisticated programs which return different results depending on user input. For example, the following script prints one of three lines of text depending on the value of the "variable" passed to it when the page is requested.

<?if ($variable eq "value1") {?>
HTML output for users with variable = value1
<?} else if ($variable eq "value2") {?>
HTML output for users with variable = value2
<?} else {?>
HTML output for users with a variable other than value1 or value2
<?}?>

 

Previous | Next

ote: MMA technical support staff cannot provide troubleshooting of problems with third-party CGI scripts including but not limited to: Perl scripts, C/C-/5++ binaries, PHP or web/database integration unless these services are specifically contracted. For these services, please see our Quote Request Form.



Copyright © 1995-2012
Motivational Marketing Associates, LLC
All Rights Reserved.