SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to pass parms when calling php from command line?

    Hi there,

    I have a script that I want to call from within a web page, and I'll like to pass in some parameters..

    For example, this is what I'd like on the web page:

    PHP Code:
    <?php include("file.php?setting1=value&setting2=value"); ?>
    Is this sort of thing possible?
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe file.php already can see setting1 and setting2 so you don't need to pass them.

  3. #3
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So that's how I would pass values into a script even if I don't call it from the web?
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  4. #4
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you mean. But if you have
    PHP Code:
    $setting1 = something;
    $setting2 = something;
    ....
    <?php include("file.php"); ?>
    Then file.php already knows what $setting1 and $setting2 are.

  5. #5
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can only have one line on my web page.. and I need to be able to call the php program AND pass in certain values. On the web page, there can't be other php code or HTML forms or anything. There is only the one line that calls a php program. So I need to be able to pass in the values along with the call to the program. (I can't set the values in the script any other way.)

    Thanks.
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  6. #6
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see. So where do those 2 settings come from? if they are not from any where in current page and you just want to set them, why not have those 2 settings in file.php itself?

  7. #7
    Confirmed Halfwit
    Join Date
    Oct 1999
    Location
    Vancouver, BC, Canada
    Posts
    983
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They need to be set on the webpage and not in the file.php program, because the file.php program is a generic script that is expecting incoming variables.

    The file.php is a script that expects a "server" value and then takes an action depending on that value.
    - A simple online WYSIWYG editor for HTML code snippets.
    - Managed Web Hosting - $3.95/month (resellers welcome)
    - Why pay more? $8.95 domains & $9.95 SSL certificates!

  8. #8
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't mind then display those 2 settings. If it's secret, then sorry, I couldn't help.


Bookmarks

Posting Permissions

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