#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    MO, US
    Posts
    119
    Rep Power
    15
    I have a PHP script that my web page accesses to confirm certain values. It uses if and else statements and then the user can click Submit to submit the values generated by the PHP script to a CGI script. The info is sent into the .cgi and generates another page.

    What I need to know is, how can I have the values generated by the PHP script be directly sent to the .cgi so the user doesn't have an unneeded "Submit" button page.
    If the values were 'name' and 'phone' what would the commands in the PHP be -
    would it be an exex() or passthru() statement?? Please help, thanks!!

    -m. ken
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,646
    Rep Power
    4492
    you could possibly use javascript to submit the form automatically to the .cgi file.

    or, maybe the header file will work. not to sure on this one though.

    header("Location: yourfile.cgi?var1=value1&var2=value2....");

    If you get all of your variables, and construct the location file in header(), you'll basically pass all of those variables along to the cgi. I think. someone comment on whether that will work, or just give it a try...

    ---JH
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    15
    This works rather well. I use this method in all of my web applications.
    ~Chris

    [QUOTE]Originally posted by SepodatiCreations:
    or, maybe the header file will work. not to sure on this one though.

    header("Location: yourfile.cgi?var1=value1&var2=value2....");

    If you get all of your variables, and construct the location file in header(), you'll basically pass all of those variables along to the cgi. I think. someone comment on whether that will work, or just give it a try...

  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    1
    Rep Power
    0
    These solutions apply to a CGI script that expects GET parameters. Is there a way for POST parameters?
  8. #5
  9. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>Is there a way for POST parameters?

    Start here -> http://www.devshed.com/Talk/Forums/F...ML/000387.html for Perl script to post to ANY script.

    At this moment, PHP is incapable to do almost ALL of the LWP's task. Even if PHP can, it's relatively slow and inefficient comparing to Perl.
    libwww-perl Official website at -> http://www.linpro.no/lwp/

    If your site performs such task often, consider using Perl for that particular task.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Germany
    Posts
    1
    Rep Power
    0
    The problem would be if any user uses his history to get to your site. He can see the params you added to the location, I don't think that's exactly what u want.

    U also can create a HTML site with <BODY onLoad="document.form1.submit()"> to aim that POST-Method if you don't want the params to be added to the location.

    That would keep users away from doing stuff like this.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    MO, US
    Posts
    119
    Rep Power
    15
    My cgi takes 5 values and uses them in the

    .cgi?command=add

    and adds the 5 items to a table - so what would it be?

    header("Location: ***.cgi?command=add&name=BC&etcetcetc");

    That might work - I will try it out - thanks but let me know what you all think
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    4
    Rep Power
    0
    If I want to call the cgi from within the PHP script, pass parameters and return a value - is that possible using exec or system or passthru ?

    cheers

    Jim

Similar Threads

  1. Doing File uploads using a PHP as CGI
    By phoebebright in forum PHP Development
    Replies: 4
    Last Post: February 16th, 2004, 05:49 AM
  2. Replies: 0
    Last Post: February 12th, 2004, 12:56 PM
  3. PHP and Table Relationship question
    By spank in forum PHP Development
    Replies: 4
    Last Post: February 9th, 2004, 09:24 PM
  4. Replies: 0
    Last Post: February 2nd, 2004, 06:44 PM
  5. PHP > HTM (mod rewrite)
    By wwhhomes in forum Apache Development
    Replies: 4
    Last Post: January 18th, 2004, 11:20 AM

IMN logo majestic logo threadwatch logo seochat tools logo