Jump to content

LHClaassen

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by LHClaassen

  1. Hi All, I am trying to creat a form that will submit data to multiple tables in the same database. I am using the code below, but this seems to only be writing data to the last table in the query. <?php $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("databasename", $con); $sql="INSERT INTO staff_churn (username ,reference ,champ ,churn_type ,effective_date ,department ,exit_department ,position ,contract_type) VALUES ('$_POST[username]' ,'$_POST[reference]' ,'$_POST[fname]' ,'$_POST[churn_type]' ,'$_POST[effective_date]' ,'$_POST[department]' ,'$_POST[exit_department]' ,'$_POST[position]' ,'$_POST[contract_type]' )"; $sql="INSERT INTO staff_churn_access (reference ,access_card ,champ_portal ,desktop ,email ,hard_phone ,lan ,laptop ,soft_phone ,g_drive ,g_folders ,h_drive ,h_folders ,distribution ,clarify_access) VALUES ('$_POST[reference]' ,'$_POST[access_card]' ,'$_POST[champ_portal]' ,'$_POST[desktop]' ,'$_POST[email]' ,'$_POST[hard_phone]' ,'$_POST[lan]' ,'$_POST[laptop]' ,'$_POST[soft_phone]' ,'$_POST[g_drive]' ,'$_POST[g_drive] $_POST[drive_a] $_POST[drive_c] $_POST[drive_e] $_POST[drive_g]' ,'$_POST[h_drive]' ,'$_POST[h_drive] $_POST[drive_b] $_POST[drive_d] $_POST[drive_f] $_POST[drive_h]' ,'$_POST[list_a] $_POST[list_b] $_POST[list_c] $_POST[list_d] $_POST[list_e] $_POST[list_f] $_POST[list_g] $_POST[list_h]' ,'$_POST[clarify_access]' )"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "<b><font color='white' face='segoe' size='2'>1 record added</b></font>"; include "/submit/redirect_churn.html"; mysql_close($con) ?> Can anyone help here?
  2. 1. I've never used the explode function so will look how this works. If I understand it correctly, the explode function will add a new entry into the database for each access type (I might need more help here to ensure that I understand it correctly)? 2. On this option you are suggesting adding additional columns to the database for the fields? and then to just have them write to the different fields? The main reason why I want to have multiple entries created is because I would like each person responsible for creating/actioning the required access types to clsoe the field once it has been created. Hope I'm understanding your explination correctly?
  3. Hi All, I'm hoping someone can help me. I'm looking to create a form that will submit multiple entries to a MySQL database depending on the options selected on the form. I am able to submit single entries, but the multiple entire is a bit of a mystery to me. I have attached an JPG image to show an example of how I would like the form to work. I have also added the description/explination below to this example: Example 1 The form was completed and three access types were selected. Thus Three entries, all with the Same Reference number were captured into the database Example 2 The form was completed and Two Access Types were selected. Thus Two entries, all with the Same Reference number were captured into the database Example 3 The form was completed and Four Access Types were selected. Thus Four entries, all with the Same Reference number were captured into the database
×
×
  • 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.