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

时间:2022-12-04 00:16:02

I've been given this code for my registration page:

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

<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>

I'm trying to use this with a template I have. The template looks like this, how can I, if at all possible, use the above code within this HTML file?

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

<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Hosting | Support</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script src="js/jquery-1.6.js" ></script>
<script src="js/cufon-yui.js"></script>
<script src="js/cufon-replace.js"></script>
<script src="js/Shanti_400.font.js"></script>
<script src="js/Didact_Gothic_400.font.js"></script>
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<style type="text/css">.button1{behavior:url("js/PIE.htc");}</style>
<![endif]-->
</head>
<body id="page5">
<div class="body1">
  <div class="body2">
    <div class="main">
      <!-- header -->
      <header>
        <div class="wrapper">
          <ul id="icons">
            <li><a href="index.html"><img src="images/icon1.gif" alt=""></a></li>
            <li><a href="#"><img src="images/icon2.gif" alt=""></a></li>
            <li><a href="contacts.html"><img src="images/icon3.gif" alt=""></a></li>
          </ul>
          <span class="call">Need Help? Please email or call <span>1-800-345-5894</span></span> </div>
        <div class="wrapper">
          <h1><a href="index.html" id="logo">Web Hosting</a></h1>
          <nav>
            <ul id="menu">
              <li class="first"><a href="index.html">Home</a></li>
              <li><a href="hosting.html">Hosting</a></li>
              <li><a href="features.html">Features</a></li>
              <li><a href="about.html">About</a></li>
              <li id="menu_active"><a href="support.html">Support</a></li>
              <li><a href="contacts.html">Contacts</a></li>
            </ul>
          </nav>
        </div>
        <span id="slogan1">Simple<span>Clever</span><span>Effective</span></span> </header>
      <!-- / header -->
    </div>
  </div>
</div>
<div class="main">
  <!-- content -->
  <section id="content">
    <div class="wrapper">
      <article class="col3">



        </article>
      </div>
    </section>
    <!-- / content  -->
  </div>
</div>
<div class="main">
  <!-- / footer -->
  <footer>Copyright &copy; <a href="#">Domain Name</a> All Rights Reserved<br>
    Design by <a target="_blank" href="http://www.templatemonster.com/">TemplateMonster.com</a></footer>
  <!-- / footer -->
</div>
<script>Cufon.now();</script>
<div align=center>This template  downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body>
</html>

1 个解决方案

#1


Since you're using <?php ?>, you need to rename your .html file into a .php file otherwise the server won't recognize when you use code.

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

Hope it helps

希望能帮助到你

#1


Since you're using <?php ?>, you need to rename your .html file into a .php file otherwise the server won't recognize when you use code.

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

Hope it helps

希望能帮助到你