• BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






PHP Switch Case

PHP Tutorials.

PHP Switch Case

New postby Ranman on Thu Mar 27, 2008 10:32 pm

# First create a file called test.html
# containing the following code.
#
<?
function main_menu () {
echo "<CENTER>main_menu function</CENTER>"; ?>
<? global $PHP_SELF; ?>
<FORM ACTION="<? echo $PHP_SELF; ?>">
<INPUT TYPE="radio" NAME="state" VALUE="Add"><B>Add User</B>
<INPUT TYPE="radio" NAME="state" VALUE="Edit"><B>Edit User</B>
<INPUT TYPE="radio" NAME="state" VALUE="Delete"><B>Delete User</B><P>
<INPUT TYPE="submit" VALUE="Submit">
</FORM><?
}
function back_link () { ?>
<A HREF="test.html">BACK</A><?
}
function add_users () {
echo "<CENTER>add_users function</CENTER>";
back_link();
}
function edit_users () {
echo "<CENTER>edit_users function</CENTER>";
back_link();
}
function delete_users () {
echo "<CENTER>delete_users function</CENTER>";
back_link();
}
switch($state) {
case "Add":
add_users();
break;
case "Edit":
edit_users();
break;
case "Delete":
delete_users();
break;
default:
main_menu();
}
?>


# Lastly point your web browser at
# http://www.your.domain.com/test.html


Demo!--->http://www.linuxguruz.org/tutorials/39Demo.php
User avatar
Ranman
Site Admin
 
Posts: 25
Joined: Thu Mar 27, 2008 12:27 am

Re: PHP Switch Case

New postby Joplin on Mon Dec 23, 2013 12:20 pm

PHP Offical Documentation
switch
User avatar
Joplin
 
Posts: 12
Joined: Tue Apr 01, 2008 12:34 am


Return to PHP Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free