1
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.jsonJSON值後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文本,不是佔有獲取在HTML文本框中通過PHP只有'1st'的盒子正在被取出。所以我應該改變wat。所有這些代碼都在編輯按鈕上。
在輸入文本框中的value屬性中使用雙引號作爲value =「'。$ value。'」'。單詞可以不用引號分配,但字符串(帶多個單詞)不能分配沒有報價 – Salim
@Salim偉大的:)從我身邊的傷心的錯誤.. –