Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:39:21+00:00 2026-05-26T13:39:21+00:00

I have a table showing information from a mysql table. I have three forms

  • 0

I have a table showing information from a mysql table. I have three forms in it that add, delete or update the database like this :

<table>
  <form method="POST" action="php/delete.php">
    <thead>
      <tr>
        <th>Nom</th>
        <th>Espéce</th>
        <th>Cri</th>
        <th>Propiétaire</th>
        <th>Age (années)</th>
        <th><input type="submit" name="supprimer" value="Supprimer" /></th>
      </tr>
    </thead>

    <tbody>
      <?php
        $connexion = mysql_connect($hote, $login, $mdp);
        mysql_select_db($bd, $connexion);

        $req = "Select * from animaux;";
        $resultat = mysql_query($req, $connexion);

        while (list($id, $nom, $esp, $cri, $prop, $age) = mysql_fetch_row($resultat)) {
      ?>

      <tr>
        <td><?= $nom ?> </td>
        <td><?= $esp ?></td>
        <td><?= $cri ?></td>
        <td><?= $prop ?></td>
        <td><?= $age ?></td>
        <td> <input type="checkbox" name="choix[]" value=<?= $id ?>></td>
      </tr>
  </form>
  <form method="POST" action="php/maj.php">
      <tr>
        <input type="hidden" name="num" value=<?= $id ?>/>
        <td><input id="nom-maj" type="text" name="nom" value=<?= $nom ?> /></td>
        <td><input id="esp-maj" type="text" name="esp" value=<?= $esp ?> /></td>
        <td><input id="cri-maj" type="text" name="cri" value=<?= $cri ?> /></td>
        <td><input id="prop-maj" type="text" name="prop" value=<?= $prop ?> /></td>
        <td><input id="age-maj" type="text" name="age" value=<?= $age ?>
                   onKeyPress='validationNombres(event)' maxlength="3" /></td>
        <td><input id="btn_maj" type="submit" name="maj" value="Mettre à jour"
        onclick=verif("maj") /></td>
      </tr>
  </form>

    <?php } ?>

  <form method="POST" action="php/add.php">  
      <tr>
        <td><input id="nom-add" type="text" name="nom" placeholder="Nom" /></td>
        <td><input id="esp-add" type="text" name="esp" placeholder="Espéce" /></td>
        <td><input id="cri-add" type="text" name="cri" placeholder="Cri" /></td>
        <td><input id="prop-add" type="text" name="prop" placeholder="Propiétaire" /></td>
        <td><input id="age-add" type="text" name="age" placeholder="Âge"
                   onKeyPress='validationNombres(event)' maxlength="3"  /></td>
        <td><input id="btn-add" type="submit" name="ajouter" value="Ajouter"
        onclick=verif("add") /></td>
     </tr>

 </form> 

  </tbody>

</table>

Is there anyway to use this forms without having to leave the page, and also update the page ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:39:21+00:00Added an answer on May 26, 2026 at 1:39 pm

    Try jquery post method..

    $("input[name=supprimer]").click(function (e){
    
        e.preventDefaults(); 
        val = $("input[name=supprimer]").val();
    
        $.post(
                "php/delete.php", //Ajax file
                "supprimer":val,  // create an object will all values
                function (data) {
    
                       //Handle Response
                       alert(data.result);
                },
                "json"
            );
    
    
    
    });
    

    In your delete.php ;

    if(isset($_POST["supprimer"]))
    {
        $supprimer = $_POST["supprimer"];
        //Delete it, Let say result is true
        $result = true;
        echo json_encode(array("result" => $result));
    }
    

    You can try similar logic for others..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When showing data from a mysql table on an php page does it have
I have a MySQL query that produces this output ordered like this: Instead I'd
Here's my case: I have a table view showing contacts. Add button in the
I have table with some fields that the value will be 1 0. This
We have a database that contains information about time booked to projects. We have
I have a crystal report that gets its data from one stored procedure, this
I have a data-structure (in plist) that looks something like this: What i have
I have a table which has records that contain a persons information and a
I have an iPhone app that grabs information from different sources in XML format.
I have File-Stream enabled database. I have created table with column that has the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.