Professional Web Applications Themes

php form can't read post data after xhtml update. help! - PHP Development

hi all! I use freeform to process in php the post data from an html page. after I switched to hxtml 1.0 transitional in the doent with the form itself, the email I receive from the php code does not contain any input entered by the user. am I missing something? the php form processing is done by FreeForm v1.0 - http://www.polyspaston.com (go to software section, it's freeware). I changed the doctype of the page and added the ending tags to the code. I also added the ID property to the input fields. the form is something similar to: <form ...

  1. #1

    Default php form can't read post data after xhtml update. help!

    hi all!
    I use freeform to process in php the post data from an html page.
    after I switched to hxtml 1.0 transitional in the doent with the
    form itself, the email I receive from the php code does not contain
    any input entered by the user.

    am I missing something?

    the php form processing is done by
    FreeForm v1.0 - http://www.polyspaston.com (go to software section,
    it's freeware).

    I changed the doctype of the page and added the ending tags to the
    code. I also added the ID property to the input fields.

    the form is something similar to:
    <form action="http://www.mysite/form%20xhtml.php?subject=mysubject""
    method="post" name="contact_form" target="_self" id="form2"
    text/plain>

    input fields are like:
    <input id="name" name="name2" type="text" />

    and finally :
    <input id="sendemail" name="send" type="submit" value="send it" />

    anybody able to explain me where I'm wrong?

    thank you in advance.
    Robert


    +RoZ Guest

  2. #2

    Default Re: php form can't read post data after xhtml update. help!

    Hi Robert,

    the first thing that looks strange is that "text/plain" shows up in the
    code w/o "type=" and quotation marks. But it would be helpful to see a
    little more of your code anyway. How does the script receive the data in
    the variables? etc.

    Cheers,
    Peter

    +RoZ wrote: 

    --
    http://www.constraints-in-discourse.de
    http://www.peter-kuehnlein.net

    Peter Guest

  3. #3

    Default Re: php form can't read post data after xhtml update. help!

    Hi Peter. Thank you for your help.

    I pasted here the old 4.01 transitional code.
    hte xhtml new code I used is enctype="text/plain".
    yet I receive the message that the form has been received by the
    server, yet the email if without the fields filled by the user.

    here's the code for the php forrm management.

    ## ALWAYS REMEMBER TO SET THESE TWO VALUES ##
    $email_to = "com"; // indirizzo pinella
    ## $email_to = "com"; // THE RECIPIENT EMAIL
    $email_from = "com"; // THE "VIRTUAL" SENDER EMAIL

    // the following is the original module page, to avoid spam
    $pagina_del_modulo
    ="http://www.strombolialbergobrasile.it/stromboli_contatti.php";

    // email_from is the address the email from your form will appear
    originating from.


    ## DON'T EDIT PAST THIS POINT ##
    // security informations gatering and elaboration

    function GetIP()
    {
    if (getenv("HTTP_CLIENT_IP") &&
    strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
    $ip = getenv("HTTP_CLIENT_IP");
    else if (getenv("HTTP_X_FORWARDED_FOR") &&
    strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
    $ip = getenv("HTTP_X_FORWARDED_FOR");
    else if (getenv("REMOTE_ADDR") &&
    strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
    $ip = getenv("REMOTE_ADDR");
    else if (isset($_SERVER['REMOTE_ADDR']) &&
    $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'],
    "unknown"))
    $ip = $_SERVER['REMOTE_ADDR'];
    else
    $ip = "unknown";
    return($ip);
    }/*-------GetIP()-------*/

    // date e hour
    $giorno = date("Y/m/d"); // year, month, day
    $ora = date("h:i:s a"); // hour, minutes, seconds


    // echo getip();
    $origine = GetIP();
    $message = "--------\n\n\n";
    $message .="Computer name: " . getenv("REMOTE_HOST") . "\n"
    . "IP address: " . getenv("REMOTE_ADDR") . "\n"
    . "Port: " . getenv("REMOTE_PORT") . "\n"
    . "User Agent: " . getenv("HTTP_USER_AGENT") . "\n"
    . "Connection: " . getenv("HTTP_CONNECTION") . "\n";
    $message .= "Data: " . $giorno . "ora: " . $ora . "\n";
    $message .= "Origine: " . $origine . "\n";

    $message .= "--------\n";

    // end of security informations gatering and elaboration

    // Form elaboration follows

    if($field_required) {
    $required = explode(",", $field_required);
    }

    $emailcontents = array();
    while (list($key, $val) = each($HTTP_POST_VARS)) {
    $val = addslashes($val); $GLOBALS[$key] = $val;
    if(!strstr($key,"field_")) {
    if(count($required)) { if (in_array($key, $required) and !$val) {
    error("$key"); }}
    array_push($emailcontents,"$key:\t$val");
    }
    }
    // title of the email in case it is not specified
    if (!$field_you_subject) { $field_you_subject = "Email dal sito IP=" .
    getenv("REMOTE_ADDR"); }
    if (!$field_them_subject) { $field_them_subject = "Thank You"; }

    $emailcontents = implode("\n",$emailcontents);
    // aggiungo i dati sull'ip del mittente
    $emailcontents .= "\n" . $message ."\n";

    $eheader= "to_you_header.txt";
    $ehandle = fopen ($eheader, "r");
    $head = fread ($ehandle, filesize ($eheader));
    fclose ($ehandle);

    $efooter= "to_you_footer.txt";
    $ehandle = fopen ($efooter, "r");
    $foot = fread ($ehandle, filesize ($efooter));
    fclose ($ehandle);

    $emailcontents = $head . "\n" . $emailcontents . "\n\n" . $foot;

    if ($email and $name) {
    mail("$email_to","$field_you_subject","$emailconte nts","From: $name
    <$email>");
    } elseif($email) {
    mail("$email_to","$field_you_subject","$emailconte nts","From:
    $email");
    } else {
    mail("$email_to","$field_you_subject","$emailconte nts","From:
    $email_from");
    }
    //in thankyou XnameX will be replaced by your name
    // Xremote_ipX will be replaced by the remote ip

    $thanks= "thankyou.txt";
    $thandle = fopen ($thanks, "r");
    $thankyou = fread ($thandle, filesize ($thanks));
    $thankyou = str_replace(XnameX, $name, $thankyou);
    $thankyou = str_replace(Xremote_ipX , $name, $thankyou) ;

    fclose ($thandle);

    if($email and $field_no_thankyou != "1") {
    mail("$email","$field_them_subject","$thankyou","F rom: $email_from");
    }

    $filename= "success.html";
    $handle = fopen ($filename, "r");
    $contents = fread ($handle, filesize ($filename));

    $contents = str_replace(XmessageX, $field_thankyou_message,
    $contents);
    print $contents;
    fclose ($handle);

    function error($field) {
    $filename= "error.html";
    $handle = fopen ($filename, "r");
    $error = fread ($handle, filesize ($filename));
    $error = str_replace(XfieldX, $field, $error);
    print $error;
    fclose ($handle);
    exit();
    }

    I added to the original freeware code some instructions to retrieve
    the ip of the sender, and the platform he is running (to optimize the
    website dimensions, styles and features on a statistical basis).

    thank you very much in advance for your help!
    robert

    On Tue, 24 May 2005 14:02:14 +0200, Peter Kühnlein
    <de> wrote:
     [/ref]

    +RoZ Guest

  4. #4

    Default Re: php form can't read post data after xhtml update. help!

    argh... I forgot to delete some real data for the location of the form
    in my last message... lot of spam will arrive.. I suppose. sadly.

    never work too late!
    never work too late!
    never work too late!



    +RoZ Guest

Similar Threads

  1. #39767 [NEW]: Binary Read of POST Data
    By deepak dot vasudevan at lavanyadeepak dot tk in forum PHP Bugs
    Replies: 0
    Last Post: December 7th, 03:42 PM
  2. redirect but with post data - mimick form post behaviour
    By LuckyNinja in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: April 14th, 05:58 PM
  3. How to post some data in form of POST action of forms in asp?
    By Mehdi Mousavi in forum ASP Components
    Replies: 1
    Last Post: September 19th, 05:16 PM
  4. form data will not post
    By Nomen Nescio in forum PHP Development
    Replies: 10
    Last Post: August 13th, 11:48 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139