form w/php action

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • danny

    form w/php action

    Hi,

    I have a form which needs posting the php script below. (I sent my vars to a
    cookie, which I have read correctly). This is the form command used in
    hoping to process my information.

    <form method="POST" action="scripts/WebContractor.p hp" name="bizinfo"
    id="bizinfo">

    Since most of this is new to me, please let me ramble in my thought process.

    1. post the vars to a cookie
    2. post the form pointing to the php script
    3. read the vars in the php script
    4. send the info from within the script

    When I submit my form, I receive a dialog box stating the downloading this
    file can be dangerous. What happens is the php script is downloaded to my
    desktop - not executed.

    Here is the php script named WebContractor.p hp:

    <?php


    $Bizname = $HTTP_GET_VARS['BizName'];
    $BizAddress = $HTTP_GET_VARS['BizAddress1'];
    $BizAddress2 = $HTTP_GET_VARS['BizAddress2'];
    $BizCity = $HTTP_GET_VARS['BizCity'];
    $BizZip = $HTTP_GET_VARS['BizZip'];
    $BizWorkPhone = $HTTP_GET_VARS['BizWorkPhone'];
    $BizHomePhone = $HTTP_GET_VARS['BizHomePhone'];
    $BizCellPhone = $HTTP_GET_VARS['BizCellPhone'];
    $BizFax = $HTTP_GET_VARS['BizFax'];
    $BizEmail = $HTTP_GET_VARS['BizEmail'];


    $rec_email = "just.testing@t hewrongplace.co m"; // send this email to myself
    $subject = "Contractor Liability Form (Web)";


    // make it pretty

    $msgInfo = "<html><hea d></head><body>";
    $msgInfo = "<font face=\"Microsof t Sans Serif\" size=\"2\">";
    $msgInfo .= "<hr width=\"100%\" size=\"1\" ><br>";


    $msgInfo .= "<b>Bizname :</b> $Bizname<br>";
    $msgInfo .= "<b>Address :</b> $BizAddress<br> ";
    $msgInfo .= "<b>Address 2:</b> $BizAddress2<br >";
    $msgInfo .= "<b>City:</b> $BizCity<br>";
    $msgInfo .= "<b>Zip:</b> $BizZip<br>";
    $msgInfo .= "<b>WorkPho ne:</b> $BizWorkPhone<b r>";
    $msgInfo .= "<b>HomePho ne:</b> $BizHomePhone<b r>";
    $msgInfo .= "<b>CellPho ne:</b> $BizCellPhone<b r>";
    $msgInfo .= "<b>Fax:</b> $BizFax<br>";
    $msgInfo .= "<b>Email:</b> $BizEmail<br>";
    $msgInfo .= "</font></body></html>";

    $header_info = "MIME-Version: 1.0\r\n";
    $header_info .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $header_info .= "From: ".$name." <".$email.">" ;


    mail($rec_email , $subject, $msgInfo, $header_info); // mail it

    ?>




    TIA
    danny


  • kaeli

    #2
    Re: form w/php action

    In article <112pgnbcej1fk0 3@corp.supernew s.com>, dthomas@planet-inc.net
    enlightened us with...[color=blue]
    > Here is the php script named WebContractor.p hp:
    >
    > <?php
    >[/color]

    This is a javascript group.
    Perhaps you meant to post this to alt.php?

    That said, you didn't set the actual PHP document as mime type html. The
    browser didn't know what to do with it, so it tried to load it.
    PHP is embedded as scriptlets INSIDE an HTML page. The PHP page needs its own
    head, title, body, etc.

    Also, if the server doesn't know to execute it, it won't. So make sure a
    simple PHP test page works.

    I use this to test.
    <html><head><ti tle>test</title></head>
    <body>
    <p>testing</p>
    <?php
    echo "<h1>Can you see this?</h1>";
    ?>
    </body>
    </html>

    The page needs to display that as all html and not show the PHP stuff. If it
    shows it all as plain text, the server is not configured right. It is the
    server which sends the content as html.

    (why is the php script in the scripts subdir? That's for perl and other cgi
    type scripts...php is a scripting language embedded in html docs, not run as
    standalone. the scripts subdir on many machines is configured as cgi-bin:
    executables.)

    HTH
    --
    --
    ~kaeli~
    Can you be a closet claustrophobic?



    Comment

    • David Dorward

      #3
      Re: form w/php action

      danny wrote:
      [color=blue]
      > When I submit my form, I receive a dialog box stating the downloading this
      > file can be dangerous. What happens is the php script is downloaded to my
      > desktop - not executed.[/color]

      Sounds like your server isn't configured to handle PHP scripts. Nothing to
      do with JavaScript whatsoever.


      --
      David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
      Home is where the ~/.bashrc is

      Comment

      • Mr.Clean

        #4
        Re: form w/php action

        <SNIP>[color=blue]
        > That said, you didn't set the actual PHP document as mime type html. The
        > browser didn't know what to do with it, so it tried to load it.
        > PHP is embedded as scriptlets INSIDE an HTML page. The PHP page needs its own
        > head, title, body, etc.
        >[/color]
        <SNIP>

        FWIW, you don't *HAVE* to place the head/title in the script as it will
        generate itself if it doesn't exist.

        Comment

        Working...