如何将此代码插入HTML文件?

时间:2015-05-11 13:46:36

标签: html

我已经为我的注册页面提供了此代码:

init

我正在尝试使用我拥有的模板。模板看起来像这样,如果可能的话,我怎么能在这个HTML文件中使用上面的代码?

<div id=mainsection>

<? $row = getcustomerdetails(); ?>

<h1>Customer Information</h1>

<? if ($error) echo "<p class='error'>You have an error in your form - please fix the issues below:</p>".$error; ?>

<p>Your contact details will be used to assign the legal owner of any domains you register, and where necessary to verify your payment information. <b>If there are any errors in the form you will not be able to complete your purchase.</b></p>

<form method='post'>

<h3>Contact Information</h3>

<table>

<tbody>

<tr><th>Salutation</th><td> <? echo salutation(); ?> </td><TD>Required</TD></tr>

<tr <? echo req(firstname); ?>><th>First Name(s)</th><td><? echo forminput('firstname'); ?></td><TD>Required</TD>

</tr>

<tr <? echo req(lastname); ?>><th>Surname</th><td><? echo forminput('lastname'); ?></td><TD>Required</TD></tr>

<tr><th>Organisation Type</th><td> <? echo orgtype(); ?> </td></tr>

<tr <? if ($row[orgtype]=="Company") echo req(orgname); ?>><th>Organisation Name</th><td><? echo forminput('orgname'); ?></td><TD>Required for companies</TD></tr>

<script type='text/javascript'>

toggle_org_name();

</script>

<tr <? echo req(address1); ?>><th>First Line of Address</th><td><? echo forminput('address1'); ?></td><TD>Required</TD></tr>

<tr><th>Second Line of Address</th><td><? echo forminput('address2'); ?></td></tr>

<tr <? echo req(city); ?>><th>Town</th><td><? echo forminput('city'); ?></td><TD>Required</TD></tr>

<tr <? echo req(county); ?>><th>County</th><td><? echo forminput('county'); ?></td><TD>Required</TD></tr>

<tr <? echo req(postcode); ?>><th>Postcode</th><td><? echo forminput('postcode'); ?></td><TD>Required</TD></tr>

<tr <? echo req(country); ?>><th>Country</th><td> <? echo formcountry(); ?> </td><TD>Required</TD></tr>

<tr <? echo reqphone(phonedefault); ?>><th>Telephone Number</th><td><? echo forminput('phonedefault'); ?><TD>Required - must be in the format +44.2081234567</TD></td></tr>

<tr <? echo reqphone(phonemobile); ?>><th>Mobile Number</th><td><? echo forminput('phonemobile'); ?></td><td>Must be in the format +44.71234567</td></tr>

<tr><th>Fax Number</th><td><? echo forminput('fax'); ?></td></tr>

<tr <? if ($_POST && !checkEmail($row[email])) echo "style='background:red'"; ?>><th>Email Address</th><td><? echo forminput('email'); ?></td><TD>Required</TD></tr>

</tbody>

</table>

<h3>Security information</h3>

<table class='left-th'>

<tbody>

<tr <? echo pass(password1); ?>><th>Password</th><td><? echo formpassword('password1'); ?></td><TD>Required</TD></tr>

<tr <? echo pass(password2); ?>><th>Confirm Password</th><td><? echo formpassword('password2'); ?></td><TD>Required</TD></tr>

<tr  <? if ($_POST && !checkdate($row[dobm],$row[dobd],$row[doby])) echo "style='background:red'"; ?>><th>Date of Birth</th><td>

<? echo dobd(); ?> / <? echo dobm(); ?> / <? echo doby(); ?>

</td><TD>Required</TD></tr>

<tr <? echo req(securityquestion); ?>><th>Choose a Security Question</th><td> <? echo securityquestion(); ?> </td></tr>

<tr <? echo req(securityanswer); ?>><th>Choose a Security Answer</th><td><? echo forminput('securityanswer'); ?></td><TD>Required</TD></tr>

</tbody>

</table>

<h3>Terms and Conditions</h3>

<p <? if ($_POST && !$_POST[terms]) echo "style='background:red'"; ?>><input type='checkbox' name='terms' value='1' /> Please click here to indicate that you accept

<a href='tandc' target='_blank'>our terms and conditions</a>.</p>

<p><input type='submit' value='<?

if ($_GET[noupsell]==1) echo "Update Details"; else echo "Register Now"?>' /></p>

</form>

</div>

1 个答案:

答案 0 :(得分:0)

由于您使用的是<?php ?>,因此您需要将.html文件重命名为.php文件,否则服务器将无法识别您何时使用代码。

希望有所帮助

相关问题