Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Do not want to close modal after submit data in modal PHP

I want to stay same modal after submitting this form

genarateBarcode.php:

<form action="savegenarateBarcode.php?id=<?php echo $d1; ?>" method="post">

savegenarateBarcode.php:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<?php

try{
session_start();
include('../connect.php');



$d1=$_GET['id'];
$b=$_POST['serialnumber'];
$sqlm = "select *from product_item where serialnumber='".$b."'";
$query = $db->prepare($sqlm);
$user_array = $query ->execute();


how can I stay same genarateBarcode.php(modal) after submiting this form?

>Solution :

I think you should use ajax because the form submit method reload the page.

var id = '<?php echo $d1; ?>';
$("#submit").click(function(){
        $.ajax({
            type: 'GET',
            url: "savegenarateBarcode.php",
            data:`id=${id}`
            success:function(data){
             alert(data);
            }
        });
    return false;
    });
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading