Jump to content

Help To Make Code Valid


thegreatone

Recommended Posts

Hi guys am trying to get my code for my contact page valid using http://validator.w3.org/check. But am no sure about solving the current error can any1 help? heres the information i getLine 55, Column 73: XML Parsing Error: xmlParsePI : no target name.....essage" cols="50" rows="10" id="message"> <?=$message;?> Line 55, Column 83: processing instruction does not start with name....rows="10" id="message"> <?=$message;?>Thanks

Link to comment
Share on other sites

as i mentioned above this code is for my contact page (html)...the code should validate whether all input boxes are coreect eg email ect and out put either a error message/ message of completionheres the full code

<div class="text" id="contentForm">          <?php $error    = ''; // error message $name     = ''; // sender's name $email    = ''; // sender's email address $subject  = ''; // subject $message  = ''; // the message itself  if(isset($_POST['send'])) { $name     = $_POST['name']; $email    = $_POST['email']; $subject  = $_POST['subject']; $message  = $_POST['message'];  if(trim($name) == '') { $error = '<div class="errormsg">Please enter your name!</div>'; } else if(trim($email) == '') { $error = '<div class="errormsg">Please enter your email address!</div>'; } else if(!isEmail($email)) { $error = '<div class="errormsg">You have enter an invalid e-mail address. Please, try again!</div>'; } if(trim($subject) == '') { $error = '<div class="errormsg">Please enter a subject!</div>'; } else if(trim($message) == '') { $error = '<div class="errormsg">Please enter your message!</div>'; } if($error == '') { if(get_magic_quotes_gpc()) { $message = stripslashes($message); }  // the email will be sent here // make sure to change this to be your e-mail $to      = "youremail@domain.com";  // the email subject // '[Contact Form] :' will appear automatically in the subject. // You can change it as you want  $subject = '[Contact Form] : ' . $subject;  // the mail message ( add any additional information if you want ) $msg     = "From : $name \r\ne-Mail : $email \r\nSubject : $subject \r\n\n" . "Message : \r\n$message";  mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"); ?>          <!-- Message sent! (change the text below as you wish)-->          <div class="c1"><span class="style1">Congratulations!!</span>            <p>Thank you <strong>              <?=$name;?>              </strong> , your message is sent!</p>          </div>          <!--End Message Sent-->          <?php } }  if(!isset($_POST['send']) || $error != '') { ?>          <p>Please use the form provided to contact me. Alternatively please feel free to contact me at any time via email or by phone. My email address and contact number are provided.</p>          <p>I look forward to hearing from you.</p>          <!--Error Message-->          <?=$error;?>          <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="">            <div class="float-left"><span class="required">*</span> Full Name:</div>            <input name="name" type="text" class="box" id="name" size="45" value="<?=$name;?>" />            <div class="float-left"><span class="required">*</span> Email:</div>            <input name="email" type="text" class="box" id="email" size="45" value="<?=$email;?>" />            <div class="float-left"><span class="required">*</span> Subject:</div>            <input name="subject" type="text" class="box" id="subject" size="45" value="<?=$subject;?>" />            <div class="float-left"><span class="required">*</span> Message:</div>            <textarea name="message" cols="50" rows="10" id="message"> <?=$message;?>    </textarea>            <br />            <!-- Submit Button-->            <div class="contact_btns">              <label>              <input type="submit" name="send" id="send" value="Submit" />              </label>              <label>              <input type="reset" name="reset" id="reset" value="Reset" />              </label>            </div>          </form>          <!-- E-mail verification. Do not edit -->          <?php }  function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i" ,$email)); } ?>        </div>

hope thats more helpful

Link to comment
Share on other sites

<?=$message; ?> is the same thing as <? echo $message; ?> (not <?php, <? is an alternative way to use open tags for PHP and may not be allowed to use on the server unless short_open_tag switched to on in the php.ini configuration file) which is PHP and like others said, you will need a server that can parse the PHP code usually with .php as the extension.

Link to comment
Share on other sites

<?=$message; ?> is the same thing as <? echo $message; ?> (not <?php, <? is an alternative way to use open tags for PHP and may not be allowed to use on the server unless short_open_tag switched to on in the php.ini configuration file) which is PHP and like others said, you will need a server that can parse the PHP code usually with .php as the extension.
Thank you you solved my problem using <?echo= instead of the <?= i had made it valid even as a html page thank you :)
Link to comment
Share on other sites

Sorry to bring up a closed topic, but if it's saved as a html file, wouldn't any tag with unrecognised attributes be counted as XML? if thats right then the reason it wasn't validating would be because the '?=' would throw the checker off - "it isn't XML but it isn't HTML - what the ###### is it?"oh and if your trying to parse PHP script in a non-PHP file surely it won't know to read it as PHP, therefor your scripts won't work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...