Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post PHP equivalent to <jsp:param>

    This is my first post, so first let me say hello.

    In JSP, I can pass parameter to an included page as follows:

    Code:
    <jsp:include page="page_include.jsp" flush="true">
       <jsp:param name="buttonClicked" value="<%=submitBtn%>" />
       <jsp:param name="navigation" value="<%=nav%>" />
    </jsp:include>
    Is there an equivalent in PHP? (I'm not talking about a simple include--require_once() and others--I mean, passing a param while including).

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,374
    Thanks
    8
    Thanked 1,075 Times in 1,066 Posts
    PHP is very nice to you ...

    If you create a variable on one page and call another page,
    or include another page, your variable is already global. It will see
    it in the other script without a need to pass it. So convenient.

    .... an HTML <form> is a little different though.
    example:
    <input type="textbox" name='myname' value=''>

    The PHP script that reads the form:
    $myname=$_REQUEST['myname'];

    So in summary ...
    If both pages are .php types, variables are global, but if you are
    passing from an HTML (.html) to a PHP (.php), you need to use
    $_REQUEST to get the variable(s).
    Last edited by mlseim; 11-07-2006 at 03:14 AM.

  • #3
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, in effect, it *is* simply requiring/including another php file (with the exception of html to php, as you note).

    I agree that this is very convenient, as I find jsp:params can get rather verbose.

    Thanks

  • #4
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,374
    Thanks
    8
    Thanked 1,075 Times in 1,066 Posts
    Tim ....

    And when/if you try it out and have problems, let us know and provide
    a link (or some PHP scripting). That will help us to assist you better.
    It sounds like you might be learning some PHP ... go for it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •