我想在codeigniter中的表格中对齐表单。当我尝试使用HTML下面的代码进行对齐时。它扔错了。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login Page</title>
</head>
<body>
<div id="container">
<h1>Login!</h1>
<?php echo validation_errors(); ?>
<?php
echo form_open('main/login_validation');
<table>
<tr>
<td>echo "<p> Email : "; </td>
<td>echo form_input('email',$this->input->post('email')); </td>
//echo "</p>";
</tr>
<tr>
<td>echo "<p> Password : ";</td>
<td>echo form_password('password');</td>
//echo "</p>";
</tr>
<tr>
<td>echo "<p>";</td>
<td>echo form_submit('login_submit','Login');</td>
//echo "</p>";
</tr>
<table>
echo form_close();
?>
<a href='<?php echo base_url()."index.php/main/signup";?>'> Sign Up </a>
</div>
</body>
</html>
错误解析错误:语法错误,意外&#39;&lt;&#39;在第18行的C:\ wamp \ www \ jobsite \ application \ views \ login.php 我想知道我做的另一件事是正确还是错误?
答案 0 :(得分:1)
第17行有一个未公开的php
标记
echo form_open('main/login_validation'); ?>
事实上,你有几个未关闭的标签,请检查
答案 1 :(得分:0)
当您切换到HTML输出时,您的标签仍处于打开状态,您需要每次都关闭PHP标记...尝试类似
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login Page</title>
</head>
<body>
<div id="container">
<h1>Login!</h1>
<?php echo validation_errors(); ?>
<?php echo form_open('main/login_validation'); ?>
<table>
<tr>
<td><p>Email :</p></td>
<td><?php echo form_input('email',$this->input->post('email')); ?></td>
</tr>
<tr>
<td><p>Password :</p></td>
<td><?php echo form_password('password'); ?></td>
</tr>
<tr>
<td></td>
<td><?php echo form_submit('login_submit','Login'); ?></td>
</tr>
</table>
<?php echo form_close(); ?>
<a href='<?php echo base_url()."index.php/main/signup";?>'> Sign Up </a>
</div>
</body>
</html>