Php to Ajax

Dear Sir,

I have following codes. These code wok fine. Is it possible to get table data with ajax. If yes then please help me to modify my code. Thanks

[PHP]<?php
require_once(“connect.php”);
$productCode = “”;
$productValue="";
if(isset($_POST[‘button1’]))
{
// Get values from form
$sno =$_POST[‘txtsno’];

	$record_check ="SELECT * FROM test WHERE sno = '$sno' ";
	$result=mysqli_query($con, $record_check);
	$row = mysqli_fetch_array($result); 
	//conditional statement starts
	if(!$row)
		die ('No record Found');
	else 
	{
		$productValue = $row['packing'];
		$productCode = $sno;
	}                    
	// Conditional statement ends
}

?>

Display data in textboxes html { overflow:auto; } body { background-color:#FFFFFF; margin:0 auto; } #mypopup { float: left; width: 250px; height: 350px; background-color:#d5eef4 ; border: 1px solid #069; text-align:center; padding:2px; margin-top:150px; margin-left:100px; overflow:auto; } #header { background-color:#3399FF; background-position:left center; line-height:25px; font-size:22px; color:#FFFF33; font-weight:600; border-bottom:1px solid #6699CC; padding:10px; }
Search Data
                    </table>
           <div style="text-align:center;margin-top:20px;">
                    <input type="submit" name="button1" value="Display">
                    <input type="reset" name="button2" value="Clear" >
                </form>
            </div>
        </div>
    </div>
</center>
<?php $close_connection = mysqli_close($con); if(!$close_connection) echo "Connection is not closing.
" . mysqli_connect_errno(); ?> [/PHP]

Code
Product

there is so much html there you can pretty much ignore the php code. don’t break any brackets and keep it as a php file other than that just add your ajax code ther eshould be no issues.

Can you please explain more?

even though you have a php page and there is php code in there, it is segmented so that any addition of css, javascript/ajax, etc should not interfere.

in other words, you want help implementing AJAX, not help with php.

Sponsor our Newsletter | Privacy Policy | Terms of Service