jquery - X-Editable Successfully POST; However, POST.PHP isn't instantiated -
two days of debugging , research , use x-editable problem. i'm using x-editable library effect inline editing of select fields. network trace shows post post.php function successful (200) , pk, name, , variable correctly sent via post request.
that said, appear though post program isn't instantiating. i've placed several echo , var_dump commands first executable statements , there no response or output provided window or console. response when open post program via browser; wherein, undefined index errors.
i appreciate insights , assistance.
<a href="#" id="course_provider" class="editable-select" data-pk="<?php echo $course_id ?>" data-value="<?php echo $course_provider ?>"><?php echo $course_provider ?></a> $('#course_code').editable(); $('#course_institution').editable(); $("#course_provider").editable({ type: 'select', title: 'select provider', placement: 'right', ajaxoptions: { type: 'post'}, source: [ {value: "uva", text: "uva"}, {value: "jmu", text: "jmu"}, {value: "upenn", text: "upenn"}, {value: "lsu", text: "lsu"} ], url: '../public/post_course.php' });
the post script
require("../includes/config.php"); define("title", "post course updates"); var_dump($_post); echo "entering post..."; /* 'pk', 'name' , 'value' in $_post array. */ $pk = $_post['pk']; $name = $_post['name']; $value = $_post['value']; /* check submitted value */ if(!empty($pk)) { $link = mysqli_connect("server", "username", "password", "database"); /* check connection */ if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } $course_id = mysqli_real_escape_string($link, $pk); $field_name = mysqli_real_escape_string($link, $name); $field_value = mysqli_real_escape_string($link, $value); // $result = mysql_query('update users set '.mysql_escape_string($name).'="'.mysql_escape_string($value).'" user_id = "'.mysql_escape_string($pk).'"'); if ($result = mysqli_query($link, 'update courses set '.$field_name.'="'.$field_value.'" course_id = "'.$pk.'"')) { echo "update successfull"; } mysqli_close($link); print_r($_post); } else { /* in case of incorrect value or error should return http status != 200. response body shown error message in editable form. */ header('http 400 bad request', true, 400); echo "this field required!"; }
?>
html 5 rescue. content editable
in article compatibility how work? examples see in html5 element can editable. using javascript event handlers can transform web page full , fast rich-text editor. article provides information functionality.contenteditable
Comments
Post a Comment