Updating called data within ajax embedded php pages via mysql(no errors appearing) -


so attempting have page via drop down menu populated database(working) calls desired data set modified. have sql injection protection implemented, drop down menu populates , desired dataset displayed. how ever can not figure out how submit data has been changed. there no error appears, nothing appears happen. have checked within database ensure data values not in fact being changed , not. appreciated!

table8.php

<html> <head> <script> function showuser(str) { if (str=="") { document.getelementbyid("txtdisp").innerhtml=""; return; } if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("txtdisp").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","getuser3.php?q="+str,true); xmlhttp.send(); } </script> </head> <body>  <form method="post" action="localhost/table8.php"> <select name="users" onchange="showuser(this.value)"> <option value="">select person:</option> <?php $con=mysqli_connect("localhost","user","password","database"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); }  $result = mysqli_query($con,"select * users");  while($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['id'] . "'>" . $row['uname'] . "</option>"; mysqli_close($con); } ?> </select> </form> <br> <div id="txtdisp"><b>person info listed here.</b></div>  </body> </html>  

getuser3.php

<?php $q = intval($_get['q']); $con=mysqli_connect("localhost","user","password","database"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); }   $sql = "select * users id = " . $q . ""; $result1 = mysqli_query($con,$sql);   echo "<table border='1'><tr><th>username</th><th>e-mail</th><th>info 1</th></tr>";  echo "<form action=\"localhost/insertgetuser.php\" method=\"post\">";  while($row1 = mysqli_fetch_array($result1, mysqli_assoc)) { echo "<tr>"; echo "<td><input type=\"text\" name=\"uname\" value=" . $row1['uname'] . "></td>"; echo "<td>" . $row1['email'] . "</td>"; echo "<td>" . $row1['info1'] . "</td>"; echo "</tr>"; }  echo "<input type=\"submit\">"; echo "</form>";  echo "</table>";  mysqli_close($con); ?>  

insertgetuser.php

<?php $con=mysqli_connect("localhost","user","password","database"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); }  // escape variables security $uname = mysqli_real_escape_string($con, $_post['uname']); $email = mysqli_real_escape_string($con, $_post['email']); $info1 = mysqli_real_escape_string($con, $_post['info1']);   $sql="update users (uname, email, info1) values ('$uname', '$email', '$info1')";  if (!mysqli_query($con,$sql)) { die('error: ' . mysqli_error($con)); } echo "1 record added";  mysqli_close($con); ?>  

<form method="post" action="localhost/insertgetuser.php"> 

does not right, want post instertgetuser.php (i doubt localhost part needed):

<form method="post" action="insertgetuser.php"> 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -