0

I want to send my form to mail with a validation. It is working but my validation does not work.

Here is my code:

$send_email = "[email protected]";
$subject = "Testing Mail.!";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

$message = "<html><head>
        <link rel='stylesheet' type='text/css' href='welfare.mswarehousing.com/stylesheets/jquery.validate.css' />
        <link rel='stylesheet' type='text/css' href='welfare.mswarehousing.com/stylesheets/style.css' />
        <script src='welfare.mswarehousing.com/js/jquery-1.3.2.js' type='text/javascript'>
        </script>
        <script src='welfare.mswarehousing.com/js/jquery.validate.js' type='text/javascript'>
        </script>

        <script type='text/javascript'>         
            jQuery(function(){
                alert('inside js function');
                jQuery('#fname').validate({
                    expression: 'if (VAL == '') return false; else return true;',
                    message: 'field is null'
                });
              });               
        </script>
    </head>
    <form name='frame' id='main_frame' action='http://welfare.mswarehousing.com/thankyou.php' method='get' enctype='multipart/form-data'>
     <table width='250' cellspacing='0' cellpadding='0' border='0' align='left'>
     <tbody>
     <tr>
     <td>
     <table width='250' cellspacing='0' cellpadding='0' border='0' bgcolor='#c7ac77'>
     <tbody>
     <tr>
     <td width='15' height='15'>&nbsp;</td>
     <td>&nbsp;</td>
     <td width='15'>&nbsp;</td>
     </tr>
     <tr>
     <td>&nbsp;</td>
     <td>
     <table width='220' cellspacing='0' cellpadding='0' border='0' align='center'>
     <tbody>
     <tr>
     <td style='font-family: Calibri,Verdana; font-size: 25px; color: #ffffff; line-height: 26px;'><strong>Show Your Interest</strong></td>
     </tr>
     <tr>
     <td height='15'>&nbsp;</td>
     </tr>
     <tr>
     <td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Name</td>
     </tr>
     <tr>
     <td bgcolor='#ededed' height='28' style='font-family: Arial,Verdana; font-size: 12px; color: #666666; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'>
     <input type='text' name='fname' size='26' id='fname' required/> 
     <input type='hidden' name='send_date' value='2015/08/08'>
     <input type='hidden' name='property_name' value='Drushtitechnet'>
     <input type='hidden' name='send_mail' value='$send_email'>
    </td>
    </tr>
    <tr>
    <td height='10'>&nbsp;</td>
    </tr>
    <tr>
    <td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Phone</td>
    </tr>
    <tr>
    <td height='28' style='font-family: Arial,Verdana; font-size: 12px; color: #666666; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'><input type='text' name='contact'  size='26' required/></td>
    </tr>
    <tr>
    <td height='10'>&nbsp;</td>
    </tr>
    <tr>
    <td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Email</td>
    </tr>
    <tr>
    <td height='28' style='font-family: Arial,Verdana; font-size: 12px; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'><input type='email' name='from'  size='26' required></td>
    </tr>
    <tr>
    <td height='15'>&nbsp;</td>
    </tr>
    <tr>
    <td valign='top'>
    <table width='220' cellspacing='0' cellpadding='0' border='0'>
    <tbody>
    <tr>
    <td height='40' style='font-family: Arial; font-size: 21px; text-align: center; background: #d24836; border: 1px solid #d24836; border-radius: 3px;'><a target='_blank' style='text-decoration: none; color: #ffffff; line-height: 40px; display: block;'><input type='submit' id='submit' value='I am Interested'></a></td>
    </tr>
    <tr>
    <td height='10'>&nbsp;</td>
    </tr>
    </tbody>
    </table>
    </td>
    </tr>
    </tbody>
    </table>
    </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td height='20'>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </tbody>
    </table>
    </td>
    </tr>
    <tr>
    <td height='20'>&nbsp;</td>
    </tr>
    </tbody>
    </table>
    </form></html>";

mail($send_email, $subject, $message, $headers);
?>
2

1 Answer 1

1

Almost all emails clients will not accept Javascript by default and with very good (security) reasons.

Lead your reader to a website with the form.

Sign up to request clarification or add additional context in comments.

1 Comment

"This is not possible" is the only answer to that question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.