[英]Replace text input value with whatever is typed inside
I've made an update form for my projects on my site. 我已经为自己网站上的项目制作了更新表格。 In my php, I populate the values of the input text tags with the existing information from the database. 在我的php中,我用数据库中的现有信息填充输入文本标签的值。 I want to be able to change the value of the input tags to whatever I type, but doesn't seem to be working. 我希望能够将输入标签的值更改为我键入的任何内容,但似乎无法正常工作。 When I hit submit, the values don't change at all (I checked my database, the fields' values are the same as before). 当我点击提交时,这些值完全没有改变(我检查了数据库,这些字段的值与以前相同)。
I feel like this is a really straightforward idea, basically any WYSIWYG/CMS functions the same. 我觉得这是一个非常简单的主意,基本上所有WYSIWYG / CMS功能都相同。 What am I doing wrong? 我究竟做错了什么? What Javascript/jQuery might I need to accomplish this? 我可能需要什么Javascript / jQuery来完成此任务?
(Oops) Here's My Code (糟糕)这是我的代码
(I'm using CodeIgniter) Here's my PHP for the input tag: (我正在使用CodeIgniter)这是输入代码的PHP:
<?php
$title_input = array(
'name' => 'title',
'id' => 'title',
'autocomplete' => 'off'
);
if (isset($updating)) {
$title_input['value'] = $project->title;
}
echo form_input($title_input);
?>
Which spits out: 哪个吐出来:
<input type="text" name="title" value="My Project Title" id="title" autocomplete="off">
When the form is submitted, this is how I (try to) change the info in the database: 提交表单后,这就是我(尝试)更改数据库中信息的方式:
$project->title = $this->input->post('title');
It's the exact same code I use for when I create a NEW project, except I was hoping that it would detect the changed input text value. 与创建新项目时使用的代码完全相同,只是我希望它可以检测到更改的输入文本值。 :/ :/
I have a page currently that takes input and stores it in the database and when the page is revisited, if there is any information previously stored, it is loaded and can be edited. 我当前有一个页面,该页面接受输入并将其存储在数据库中,并且当重新访问该页面时,如果以前存储了任何信息,则将其加载并可以进行编辑。 upon submit, I save again. 提交后,我再次保存。
Things you should consider: 您应该考虑的事项:
More assistance could be provided if you willing to share your code 如果您愿意共享代码,则可以提供更多帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.