Note that there are some explanatory texts on larger screens.

plurals
  1. POusing ajax to display a message when data get inserted in to the data base
    primarykey
    data
    text
    <p>I've searched through the StackOverFlow but didn't found what I was looking for so I'm posting what I want to ask you.</p> <p>I'm a new comer to the world of PHP any how I've started to write a script which will get data and display on a WAP interface that part is ok my issue is in the part I'm writing for the data insert page or the Admin page. I've got every thing working but I love to know how to use AJAX to display a message with out going to the particular processing page.</p> <p>The Process Page,</p> <pre><code>&lt;?php include ('connect.php'); $data = ("SELECT * FROM poiinfo"); $poiName = $_REQUEST['Name']; $poiDes = $_REQUEST['Descrip']; $poiCon = $_REQUEST['ConInfo']; /*$poiImg = $_REQUEST['Image']; */ $dbData = "INSERT INTO poiinfo(`Name`, `Des.`, `Contact`) VALUES ('$poiName','$poiDes','$poiCon')"; $putData = mysql_query($dbData); if ($putData){ echo "Data inserted"; }else { echo "Not Done"; } ?&gt; </code></pre> <p>Can I know how to use AJAX to get an message.</p> <p>I've used the code examples that you guys gave me but I'm still not getting the job done please can you help me to find what I'm doing wrong.</p> <p>My Form,</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#save_data").click(function(){ var name = document.getElementById("Name"); var desc = document.getElementById("Descrip"); var con = document.getElementById("ConInfo"); var dataString = 'Name='+name'&amp;Descrip='+desc'&amp;ConInfo='con; $.ajax({ type:'POST', data:dataString, url:'addpoipro.php', success:function(data){ if(data="Data inserted") { alert("Insertion Success"); } else { alert("Not Inserted"); } } }); }); }); &lt;/script&gt; &lt;title&gt;AddPOI&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post" enctype="multipart/form-data" name="form1" id="form1"&gt; &lt;p&gt; &lt;label for="poiid"&gt;ID :&lt;/label&gt; &lt;input type="text" name="poiid" id="poiid" readonly="readonly" style="width:70px;" value="&lt;?php echo $tId; ?&gt;" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="Name"&gt;POI Name :&lt;/label&gt; &lt;input type="text" name="Name" id="Name" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="Descrip" style="alignment-adjust:middle"&gt;POI Description :&lt;/label&gt; &lt;textarea name="Descrip" id="Descrip" cols="45" rows="5"&gt;&lt;/textarea&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="ConInfo"&gt;Contact Infomation :&lt;/label&gt; &lt;textarea name="ConInfo" id="ConInfo" cols="45" rows="5"&gt;&lt;/textarea&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="Img"&gt;POI Image :&lt;/label&gt; &lt;!--&lt;input type="file" name="Image" id="Image" /&gt; --&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt; &lt;div align="center"&gt; &lt;input type="button" name="Submit" id="save_data" value="Submit" style="width:100px;" /&gt; &lt;input type="reset" name="reset" id="reset" value="Rest Data" style="width:100px;" /&gt; &lt;/div&gt; &lt;/p&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Above4 is my form and the process.php is before that please help me thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload