Results 1 to 3 of 3

Thread: Help on PHP Form Submit

  1. #1
    Join Date
    Sep 2004
    Location
    Little Falls, Roodepoort, South Africa
    Posts
    421
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Help on PHP Form Submit

    Hi

    I've writen a script that should work with my form, however it does'nt, any suggestions please:

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>VAGMOSMailer</title>
    <body>


    <?php
    switch ($op) {

    case send:

    $config = "-finfo@nexgen.co.za";

    $subject="Information Request from VAGMOS Web Site";

    $txtto="info@vag.co.za"

    $msg="Please respond in a timely manner.Thanks in advance";


    mail("$txtto","$subject","$msg","$config");
    header("Location: http://www.vagmos.co.za/thanks.htm");
    ?>

    <?
    break;
    On the form itself I have this line:
    <form name="frmMail" Action="formmail.php?op=send" method="post">
    Very Best Rgds, Simonf :cool:
    __________________________________
    My Site | E-Mail Me

  2. #2
    Join Date
    Sep 2004
    Location
    UK
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Are you getting a parse error? If so, the line:
    $txtto="info@vag.co.za"
    is missing the semi-colon at the end and the switch statement is unterminated.

    In case those are just from cutting the code down for the post and you're not getting a parse error:
    Are you getting the emails at info@vag.co.za? If you're checking the script by seeing if the redirect works, then that won't work. Headers need to be sent before any content is outputted so put the PHP code before <html>. If you have other cases that don't need the redirect, and so need the html code, you can leave them where the current PHP code is.

    If you aren't getting the emails, then it could be that your web host has register_globals off.
    ie: $op is undefined, so nothing will happen in your switch statement. Variables from the query string are stored in the $_GET array (in PHP v4.1 or later), so you would want to replace the switch with:
    switch ($_GET['op']) {
    case "send":

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I don't have much to add...

    Quote Originally Posted by simonf
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    You shouldn't use proprietary character sets. You'd probably be better off using iso-8859-1 (aka Latin 1). Moreover, you should be sending the character set (and content type in general) via HTTP Response headers, not meta elements. Unless your server's "broken" (like mine - I can't change the default character set as that's an administrator operation ), do this part properly.

    switch ($op) {
    Unless your host's PHP version doesn't support super globals, like $_GET, you should avoid using the EGPCS variables even if they are available.

    Mike

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
  •