0

我有一个页面,用户可以在其中编辑他输入的关于自己的信息。这是代码:

<html>
<head>
<title></title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

</head>
<body dir="rtl">



<?php echo form_open('profile/edit'); ?>

<h5>الاسم الكامل</h5>
<input type="text" name="fullname" value="<?php echo $fullname; ?>" />

<h5>الايميل</h5>
<input type="text" name="email" value="<?php echo $email; ?>"  />


<h5>الجوال</h5>
<input type="text" name="mobile" value="<?php echo $mobile; ?>"  />

<h5>هاتف</h5>
<input type="text" name="telephone" value="<?php echo $telephone; ?>" />

<h5>العنوان</h5>
<input type="text" name="address" value="<?php echo $address; ?>"  />

<h5>نبذة عني</h5>
<textarea rows="4" cols="50" name="about" value="<?php echo $about; ?>"> </textarea>
<br><br>

<div><input type="submit" value="Submit" /></div>

</form>

</body>
</html>

现在,当我提交时,它向我显示了这些错误:

在此处输入图像描述

我不知道发生了什么。这只发生在我提交带有编辑数据的表单时。否则,它首先会在字段中加载正确的详细信息。

非常感谢您的帮助::)

4

3 回答 3

0

试试看 。

<html>
<head>
<title></title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

</head>
<body dir="rtl">



<?php echo form_open('profile/edit'); ?>

<h5>الاسم الكامل</h5>
<input type="text" name="fullname" value="<?php echo (!empty($fullname)?$fullname:""); ?>" />

<h5>الايميل</h5>
<input type="text" name="email" value="<?php echo (!empty($email)?$email:""); ?>"  />


<h5>الجوال</h5>
<input type="text" name="mobile" value="<?php echo(!empty($mobile)?$mobile:""); ?>"  />

<h5>هاتف</h5>
<input type="text" name="telephone" value="<?php echo (!empty($telephone)?$telephone:""); ?>" />

<h5>العنوان</h5>
<input type="text" name="address" value="<?php echo (!empty($address)?$address:""); ?>"  />

<h5>نبذة عني</h5>
<textarea rows="4" cols="50" name="about" value="<?php echo (!empty($about)?$about:""); ?>"> </textarea>
<br><br>

<div><input type="submit" value="Submit" /></div>

</form>

</body>
</html>
于 2013-04-05T07:18:46.037 回答
0

您是否有任何理由不使用表单助手类来生成字段?确保类是通过$this->load->helper('form');首先加载的。您可以通过 使用表单输入助手echo form_input('username', 'johndoe');。此外,您的问题在于您的value领域。$fullname没有价值,因此您需要通过以下方式进行补偿:

// using HTML
<input type="text" name="fullname" value="<?php echo isset($fullname) ? $fullname : ''; ?>" />

// using form_input()
$data = array(
    'type' => 'text',
    'name' => 'fullname',
    'value' => isset($fullname) ? $fullname : ''
);
echo form_input($data);

希望这可以帮助你!

于 2013-04-05T07:20:01.597 回答
0

您确定将值设置为包含所有用户信息(如电子邮件等)的视图吗?最好在使用用户信息查看之前检查您是否重新填充信息。

并在视图中检查变量是否已设置 (!empty($fullname)? echo $fullname: '');

希望这会有所帮助!

于 2013-04-05T07:40:19.903 回答