0

I am trying to add a input box that has the phone section in it. I did add it in.. But it doesn't load in the message that I get in the email.. if i change around the code. I can get just the phone number to show in the email.. But then I can't get the email to show.. How would I combine both?

exit;
    } 
if (empty ($senders_name)) 
    {
    $error = "1";
    $info_error .= $lang_noname . "<br>"; 
    }
if (empty ($senders_email)) 
    {
    $error = "1";
    $info_error .= $lang_noemail . "<br>";  
    }
if (empty ($mail_subject)) 
    {
    $error = "1";
    $info_error .= $lang_nosubject . "<br>";  
    }
    if (empty ($mail_phone)) 
    {
    $error = "1";
    $info_error .= $lang_phone . "<br>";  
    }
if (empty ($mail_message))  
    {
    $error = "1";
    $info_error .= $lang_nomessage . "<br>";  
    }
if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $senders_email))
    {
    $error = "1";
    $info_error .= $lang_invalidemail . "<br>"; 
    }
if (empty ($security_code))  
    {
    $error = "1";
    $info_error .= $lang_nocode . "<br>";  
    }
elseif ($security_code != $randomness)  
    {
    $error = "1";
    $info_error .= $lang_wrongcode . "<br>";  
    }
if ($showlink != "no")
    {
    $link = "";
    }
if ($error == "1") 
    {
    $info_notice = "<span style=\"color: " . $error_colour . "; font-weight: bold;\">" . $lang_error . "</span><br>"; 

    if (empty ($submit)) 
        {
        $info_error = "";
        $info_notice = $lang_notice;
        }   

    function Random() 
        {
        $chars = "ABCDEFGHJKLMNPQRSTUVWZYZ23456789";
        srand((double)microtime()*1000000);
        $i = 0;
        $pass = '' ;
        while ($i <= 4) 
            {
            $num = rand() % 32;
            $tmp = substr($chars, $num, 1);
            $pass = $pass . $tmp;
            $i++; 
            } 
        return $pass; 
        }
    $random_code = Random();
    $mail_message = stripslashes($mail_message);

    print "<form name=\"email\" method=\"post\" style=\"margin: 0;\" action=\"\">
  <table  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
    <tr align=\"$title_align\" valign=\"top\">
      <td colspan=\"2\"><span style=\"$title_css\">$lang_title</span></td>
    </tr>
    <tr align=\"left\" valign=\"top\">
      <td colspan=\"2\">$info_notice$info_error</td>
    </tr>
    <tr valign=\"top\">
      <td align=\"right\">$lang_name</td>
      <td align=\"left\"><input name=\"senders_name\" type=\"text\" class=\"mailform_input\" id=\"senders_name\" style=\"width: $input_width;\" value=\"$senders_name\" maxlength=\"32\"></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_youremail</td>
      <td align=\"left\"><input name=\"senders_email\" type=\"text\" class=\"mailform_input\" id=\"senders_email\" style=\"width: $input_width;\" value=\"$senders_email\" maxlength=\"64\"></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_subject</td>
      <td align=\"left\"><input name=\"mail_subject\" type=\"text\" class=\"mailform_input\" id=\"mail_subject\" style=\"width: $input_width;\" value=\"$mail_subject\" maxlength=\"64\"></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_phone</td>
      <td align=\"left\"><input name=\"mail_phone\" type=\"text\" class=\"mailform_input\" id=\"mail_phone\" style=\"width: $input_width;\" value=\"$mail_phone\" maxlength=\"64\"></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_message</td>
      <td align=\"left\"><textarea name=\"mail_message\" cols=\"36\" rows=\"5\" style=\"width: $input_width;\" class=\"mailform_input\">$mail_message</textarea></td>
    </tr>
    <tr align=\"left\" valign=\"top\">
      <td width=\"100\">$lang_confirmation</td>
      <td><input name=\"security_code\" type=\"text\" id=\"security_code\" size=\"5\"> 
        &nbsp;&nbsp;&nbsp;&nbsp;<b>$random_code</b></td>
    </tr>
    <tr valign=\"top\">
      <td colspan=\"2\" align=\"right\"><input name=\"randomness\" type=\"hidden\" id=\"randomness\" value=\"$random_code\">
      <input name=\"submit\" type=\"submit\" id=\"submit\" value=\"$lang_submit\" class=\"mailform_button\"></td>
    </tr>
  </table>
</form>";
    }
else
    {



    if ($checkdomain == "yes") 
        {
        $sender_domain = substr($senders_email, (strpos($senders_email, '@')) +1);
        $recipient_domain = substr($sendto_email, (strpos($sendto_email, '@')) +1);
        if ($sender_domain == $recipient_domain)
            {
            print "Sorry, you cannot send messages from this domain ($sender_domain)";
            exit;
            }       
        }


    $info_notice = $lang_sent;
    $mail_message = stripslashes($mail_message);
    $senders_email = preg_replace("/[^a-zA-Z0-9s.@-]/", " ", $senders_email);
    $senders_name = preg_replace("/[^a-zA-Z0-9s]/", " ", $senders_name);
    $headers = "From: $senders_name <$senders_email> \r\n";
    $headers .= "X-Mailer: PHP mailer \r\n";
    mail($sendto_email, $mail_subject, $mail_message, $headers);
    print "  <table  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
    <tr align=\"$title_align\" valign=\"top\">
      <td colspan=\"2\"><span style=\"$title_css\">$lang_title</span></td>
    </tr>
    <tr align=\"$title_align\" valign=\"top\">
      <td colspan=\"2\">$info_notice</td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_name</td>
      <td align=\"left\"><b>$senders_name</b></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_youremail</td>
      <td align=\"left\"><b>$senders_email</b></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_subject</td>
      <td align=\"left\"><b>$mail_subject</b></td>
    </tr>
     <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_phone</td>
      <td align=\"left\"><b>$mail_phone</b></td>
    </tr>
    <tr valign=\"top\">
      <td width=\"100\" align=\"right\">$lang_message</td>
      <td align=\"left\"><b>$mail_message</b></td>
    </tr>
  </table>";
    }
print $link;
?>
2
Contributors
4
Replies
7
Views
4 Years
Discussion Span
Last Post by xbat
0

@xbat

if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $senders_email))

Why are you using eregi?

Read the php.net:

http://php.net/manual/en/function.eregi.php

And also

Have try to read these examples:

http://phpmailer.worxware.com/index.php?pg=examples

and also read the tutorial

http://phpmailer.worxware.com/index.php?pg=tutorial

The reason why I ask because I don't see any echo in whole code you provided? How would you know it was send or not or how did you got your results? Plus it's better to have a code more up to date in the phpmailer rather than your code?

0

Thank you for the other tips... But I was asking about the phone input box was sending.

0

@xbat

But I was asking about the phone input box was sending.
How would I combine both?

I don't see you have a print_r($_POST); if you want to combine email & phone. Then you need to ($_POST).

  'email' => $input->post->email,
  'phone' => $input->post->phone,
0

Quoted Text Here

Thanks lastmich I get what your saying now with the php.net site. I didn't think that far down the road.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.