在JSON数据中的空格后,PHP无法在HTML文本框中获取JSON值

阿比舍克·卡达迪(Abhishek Kadadi)
if(isset($_POST['files'])){

echo $name=$_POST['files'];
$name1=$_POST['path'];
if(isset($_POST['edit']))
{
$jsonString = file_get_contents("./events/$name1/data.json");
$data = json_decode($jsonString,true);


foreach ($data as $key => $value) {
   if ($value['sub_event_name'] == $name) {
    $id=$value['sub_event_id'];
$name=$value['sub_event_name'];
    $Description=$value['sub_event_description'];
 $Fees=$value['sub_event_entryfees'];
 $Prize=$value['sub_event_prizemoney'];
 $Location=$value['sub_event_location'];
 $Time=$value['sub_event_time'];
 $Head=$value['sub_event_head_name'];
 $Contact=$value['sub_event_head_contact'];
}
}


echo '<form action="editsubmit.php" method="post">';
echo 'Main Event:<input type="hidden" name="path" value='.$name1.' readonly />';
echo 'Id: <input type="text" name="id" id="id" value='.$id.' readonly /><br />';
echo 'Event Name : <input type="text" name="eventname" id="id" value='.$name.' required      /><br />'; 
echo 'Event Description:<input type="text" name="description" id="id"          value='.$Description.' required /><br />';
echo 'Entry Fees:<input type="text" name="fees" id="id" value='.$Fees.' required /><br />';
echo 'Prize:<input type="text" name="prize" id="prize" value='.$Prize.' required /><br />';
echo 'Location Of Event:<input type="text" name="location" id="id" value='.$Location.' required /><br />';
echo 'Time and date of Event:<input type="datetime-local" name="time" id="id" value='.$Time.' required /><br />';
echo 'Event Head Name:<input type="text" name="head" id="head" value='.$Head.' required /><br />';
echo 'Event Head Contact:<input type="text" name="contact" id="id" value='.$Contact.' required /><br />';

echo '<input type="submit"/>';
echo '</form>';
    }

data.json

 [{"sub_event_id":"270CA7507EBE029BC6638437F83105C0","sub_event_name":"counter-       strike","sub_event_description":"1st person action game.","sub_event_entryfees":"150Rs","sub_event_prizemoney":"1st-4000Rs ,2nd-     3000Rs,3rd-2000Rs,","sub_event_location":"IT department","sub_event_time":"2013-10-  30T09:00","sub_event_head_name":"Abhishek","sub_event_head_contact":"787xxxx7"},

现在举个例子->

"sub_event_description":"1st person action game."

因此在html文本框中,仅会提取“ 1st”。所以我应该做wat更改。所有这些代码都在“编辑”按钮上。

最大回声

在输入文本框中的value属性中使用双引号value="'.$value.'"单词可以不带引号分配,但是字符串(带有多个单词)不能不带引号分配。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

JSON中的LocalStorage文本框

文本框中未显示角度json值

选择下拉列表后如何使用从mysql表中获取的数据填充多个文本框

无法在文本框中输入值

用户输入后无法设法获取文本框的值

无法获取jQuery自动完成中的文本框的值

无法在html文本框中显示0值

Json响应未在文本框中显示值

回发后CKEditor无法从ASP.NET文本框中捕获数据

如何在HTML5中从LocalStorage获取的文本框中设置值

从下拉框中获取选定的值,并用于填充文本框php javascript

如何从Angular.js中的json获取文本框值

使用PHP从文本框数组中获取单击的文本框的值

从文本框中获取用户数据并将其写入特定的json名称

JavaScript无法在HTML中执行文本框值

在php变量中添加html文本框值

我如何从单独的文本框中的自动完成响应获取json键和值。请看图片

如何根据选定的值并参考php中的数据库将值获取到文本框?

如何获取逗号分隔的循环文本框值,在jSON中插入到jquery的mysql数据库中

在php中选择下拉菜单时,在多个文本框中获取数据库值

从文本框中获取JSON网址?

无法使用 PHP 从 JSON 中获取数据

在文本框中获取过去值后的文本值

无法从 JSON 数据中获取键的值

无法从 html 上的文本框中获取参数

从编辑文本框中获取数据

PHP验证文本框中的数据

在 jQuery 中获取文本框值

C# 中的变量无法从 html 文本框中获取值