Home Is there a way to submit multiple forms to insert data in specific column?
Reply: 2

Is there a way to submit multiple forms to insert data in specific column?

Pirjol Nelu
Pirjol Nelu Published in 2017-12-07 21:28:25Z
if( $_SESSION['user_id'] == '1' || $_SESSION['user_id'] == '7' )
    echo '<hr class="mx-3 my-0">
            <div class="callout callout-warning m-0 py-3">
                <strong>Sas Andreea</strong>
              <small class="text-muted mr-3"><i class="icon-calendar"></i>Salariu Lunar:</small>
              <small class="text-muted"><i class="icon-location-pin"></i><input type="text"  name="salariulunar" value="' . $row[
  'salariulunar'] . '"  maxlength="4" size="4"> lei 
              <br /> Data contract: <input type="text"  name="datacontractului"  maxlength="10" size="7" value="' . $row['datacontractului'] . ' ">
              <br /> Datorie: <input type="text"  name="datorie" value="' . $row['datorie'] . '"   maxlength="4" size="4"> Lei
              <br /> Salariu in avans: <input type="text" value="' . $row['salariuavans'] . ' " name="salariuavans"  maxlength="4" size="4"> Lei
              <br /> Zile de concediu luate: <input  type="text" value="' . $row['zileconcediu'] . '"  name="zileconcediu"  maxlength="2" size="2"> Zile
<!-- Sfarsit angajat -->
if( $_SESSION['user_id'] == '1' )
    echo '<button type="submit" name="submit" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o" ></i> Modifica</button>';

I have this form , but i need to use it for more users ex for user_id=1 to submit 1 form for user_id=2 to submit another form, can you guys help?

the database table have a column u_userid where 1 = admin 2,3,4,5,6,7 is normal user, each user has more columns wich i need to update data from database

Omkaar.K Reply to 2017-12-07 21:42:41Z

You can fix it by making the If statement like this... If($_SESSION['user_id'] == '2')

Use the update feature and then add a ‘where user_id = 1’ in the end of your statement

gibberish Reply to 2017-12-07 21:41:40Z

You have two options:

  1. You can use a form, which requires that you have the
    <form action="nameOfYourBackEndFile.php" method="post">
           Your existing stuff in here
    tags surrounding your existing code AND you need a button type="submit" to submit the form.


  1. You can use javascript/jQuery. Either way is fine.

Also, you need a way to identify which user this form is being filled out for. You have the user_id in a session variable, so why not use that? Your submit button can look like this:

<button id="submit_<?php echo $_SESSION['user_id']; />" type="submit">Go</button>

See this example for more information about what you are trying to do:

How can I make, when clicking a button, send an email with the data included from the form?

PHP - Secure member-only pages with a login system

AJAX request callback using jQuery

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.380879 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO