Jump to content

PHP, MYSQL


raj957

Recommended Posts

<label>Select BluePack Bank</label>

<select class="form-control" name="advising_bank">

      <option>Select a bank</option>

             <?php

                    $sqll = "SELECT * FROM bpbank";

                   $sql_run = mysqli_query($connect,$sqll);

                    if(mysqli_num_rows($sql_run)){

 

 

 

                   while($row = mysqli_fetch_assoc($sql_run)){

           ?>

            <?php $option ?> = <option value = "<?php echo $row['bank_name']  .  $row['address']  .  " swiftcode: " . $row['swift_code']  .  $row['bin_no']; ?>"><?php echo $row['bank_name'];?></option>

       <?php

      echo $option;

  };

};

 

 

 

      ?>

 

 

 

</select><br>

 

 


As you can see i have selected all data from a table called bpbank(column names: bank_name, address, swift_code,bin_no). I am showing those data in a drop down list, where i put all the values in the option values="". Now upon submit i want to carry all these data to another table, name:client bank, having the same columns and column names. How do i do it, since all the values in the option are having the same input name given in the <select class="form-control" name="advising_bank"> which is advising_bank.


I would appreciate if someone would look into it....


Edited by raj957
Link to comment
Share on other sites

Don't.

 

The best thing is not to send the bank information but the bank identifier - an ID or some other unique value in the table. Then in the next page you take the ID and look up the bank details in the database again.

 

Sound repetitive? It is. But it needs to be. Information in a form can be modified by anyone easily, so even if you put a particular name and code and whatever into the form, the user can change all that information to be whatever they want instead. With the ID the user can still modify the value, yes, but it's safe because (a) either the new value doesn't exist in the table and you don't find the bank details or (b) it does exist and it's like the user had just picked a different option.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.