【发布时间】:2011-11-22 05:19:02
【问题描述】:
我正在处理这个学校项目,但我无法让我的表格正常显示和运行。
问题/疑问:
1) 我什至可以在 HTML 文档“内部”使用这个 PHP 吗?
(The Demo I am Trying to Follow)
这是我的表单条目(在 HTML 文档中):
<div id="formWrap">
<div id="form">
<form action="contact.php" method="post" id="comments_form">
<div class="row">
<div class="label">Your Name</div>
<div class="input">
<input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" />
<?php if(in_array('fullname', $validation)): ?><span class="error"><?php echo $error_messages['fullname']; ?></span><?php endif; ?>
</div> <!-- end input class -->
<div class="context">e.g. John Smith or Jane Doe</div><!-- end context class -->
</div><!-- end row class -->
<div class="row">
<div class="label">Your Email Address</div>
<div class="input">
<input type="text" id="email" class="detail" name="email" value="<?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" />
<?php if(in_array('email', $validation)): ?><span class="error"><?php echo $error_messages['email']; ?></span><?php endif; ?>
</div> <!-- end input class -->
<div class="context">We will not share your email address with anyone.</div><!-- end context class -->
</div><!-- end row class -->
<div class="row">
<div class="label">Tell Us All About It!</div>
<div class="input">
<textarea id="comment" name="comment" class="mess">
<?php echo isset($_POST['comment'])? $_POST['comment'] : ''; ?>
</textarea>
<?php if(in_array('comment', $validation)): ?><span class="error"><?php echo $error_messages['comment']; ?></span><?php endif; ?>
</div> <!-- end input class -->
</div><!-- end row class -->
<div class="submit">
<input type="submit" id="submit" name="submit" value="Send Message" />
</form>
<?php else: ?>
<p>Thank you for your Message!</p>
<?php endif; ?>
</div><!-- end submit class -->
</div><!-- end form -->
<?php if($form_complete === FALSE): ?>
</div><!-- end form wrap -->
【问题讨论】:
-
PHP 是否安装在托管该网站的服务器上?否则,PHP 将无法工作。