Maximum string variable length in contact form?

Discussion in 'PHP' started by pajhonka@yahoo.com, Sep 22, 2010.

  1. #1
    Hi,
    I have a Flash contact form that sends its name, e-mail, and message variables to a PHP script. The script works fine if the message is under ~700 characters, but anything more and the script won't post the message at all. An e-mail with just the name and e-mail address will come through to my inbox (which is embarrassing as a potential client sent me a contact form e-mail about a development job :eek:).

    Is there some way to check the maximum character length for a string variable? Or to set its length to something higher?

    This is my php. Thank you!!
    
    <?
    
    $senderName   = $_POST['userName'];
    $senderEmail     = $_POST['userEmail'];
    $senderMessage = $_POST['userMsg'];
    $senderName   = stripslashes($senderName);
    $senderMessage   = stripslashes($senderMessage); 
    $senderMessage = strip_tags($senderMessage, '<p><br>');
    $to = "kevin@kevinburkeportfolio.com";
    $from = "email@kevinburkeportfolio.com";
    $subject = "E-mail from $senderName";
    
    $message = "<p><font size='2.5' face='Helvetica Neue, Helvetica, Sans Serif'><b>FROM:</b> $senderName
    <br><br>
    <b>E-MAIL:</b> <a href='mailto:$senderEmail'>$senderEmail</a>
    <br><br>
    <b>MESSAGE:</b> $senderMessage</p>";
    
    $headers = "From: $from\r\n";
    $headers = "MIME-Version: 1.0\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $to = "$to";
        mail($to, $subject, $message, $headers);
    	
    	$my_msg = "Thanks $senderName, your message has been sent.";
        print "return_msg=$my_msg"; 
    
    exit();
    ?>
    PHP:

     
    pajhonka@yahoo.com, Sep 22, 2010 IP
  2. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Don't use flash :D
    lol

    Honnestly, I don't see anything wrong with the above code.
    To experiment, you can create an html page with a form pointing to this script to simulate, then you can see if it works ok

    aXe
     
    axelay, Sep 23, 2010 IP
  3. imperialDirectory

    imperialDirectory Peon

    Messages:
    395
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd say the limitation could be in the flash itself. Maybe the code in flash truncates the whole message when it reaches certain length?
    By default you can POST 2MB of data in PHP. So the limit should be thousands of characters.
     
    imperialDirectory, Sep 23, 2010 IP
  4. Internet Monk

    Internet Monk Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It doesn't have any limitations. Try increasing memory and POST limit.
     
    Internet Monk, Sep 23, 2010 IP
  5. pajhonka@yahoo.com

    pajhonka@yahoo.com Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you. How would I do that?
     
    pajhonka@yahoo.com, Sep 23, 2010 IP