Jump to content

Maximum string variable length in contact form?


pajhonka

Recommended Posts

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  :-[).

 

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();
?>

Link to comment
Share on other sites

The only limit, as far as php is concerned, is the amount of memory available. There are 'security' patches that could impose such limits and your web host might be using it/them.

 

Start by checking if your php script is receiving what you expect. Add the following to your php code -

 

echo "<pre>";
echo "POST:";
var_dump($_POST);
echo "</pre>";

 

Php does impose a maximum size of all the post data using the post_max_size setting (AFIAK exceeding this will result in an empty $_POST array, not simply data cut off at some point.) The default  post_max_size setting is 8M.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.