0

Hi everyone how are you? I want to share my php problem with you. Please! help me if you can. I am making a database for employees’ record. I want to keep Experience head just one time, and if anyone wants to add more experience, he/she just click on add more and same more fields should be displayed. For details I have attached codes.


My problem is very simple. When I enter the data in initial text fields, it goes to database. But when I enter in add more text fields, it is not transferring the data into database.


Thank you!


Kindest Regards,
John Webb
atpdesigner@gmail.com


add more4.php

<?php
//include('connecton.php');

require('connection.php');

if($_SERVER['REQUEST_METHOD']=='POST')
	
	{
	$org = $_POST['org'];
	
	$des = $_POST['des'];
	
	$stat = $_POST['stat'];
	
	$duty = $_POST['duty'];
	 
	$from = $_POST['from'];
	 
 	$to = $_POST['to'];
	
	mysql_query("insert into exp values('$org','$des','$stat','$duty','$from','$to')");	
}

?>


<!-- FORM: HEAD SECTION -->
	<link href="http://www.tfaforms.com/themes/get/15448" rel="stylesheet" type="text/css"></link>
	<link href="http://www.tfaforms.com/wForms/3.4/css/wforms-jsonly.css" rel="alternate stylesheet" title="This stylesheet activated by javascript" type="text/css"></link>

<link href="http://www.tfaforms.com/wForms/3.4/css/wforms-layout.css" rel="stylesheet" type="text/css"></link>
<!--[if IE 8]>
<link href="http://www.tfaforms.com/wForms/3.4/css/wforms-layout-ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if IE 7]>
<link href="http://www.tfaforms.com/wForms/3.4/css/wforms-layout-ie7.css" rel="stylesheet" type="text/css"></link>
<![endif]-->
<!--[if IE 6]>
<link href="http://www.tfaforms.com/wForms/3.4/css/wforms-layout-ie6.css" rel="stylesheet" type="text/css"></link>
<![endif]-->
<link href="js/wforms-layout-ipad.css" rel="alternate stylesheet" title="This stylesheet activated for iPad only" type="text/css" />

<script type="text/javascript" src="js/wforms.js"></script>
<script type="text/javascript" src="js/wforms_custom_validation.js"></script>
<script type="text/javascript" src="js/localization-en_US.js"></script>

	
	<link rel="stylesheet" type="text/css" href="js/wforms_calendar.css" />
	<script type="text/javascript" src="js/yui/yui-min.js" ></script>
	<script type="text/javascript" src="js/wforms_calendar.js"></script>
<script type="text/javascript" src="js/wforms_prefill.js"></script>
<link href="js/form.css" rel="stylesheet" type="text/css"></link>
<style type="text/css">
</style>

<!-- FORM: BODY SECTION -->
<div class="wFormContainer">
<div class="wForm wFormWidth">
<div class="codesection" id="code-wf_EmploymentApplica"><style type="text/css">
table .headerRow th{
font-weight: normal !important;
}
</style></div>
<form method="post" action="" id="wf_EmploymentApplica" class="labelsAbove hintsTooltip" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="20971520">
<fieldset id="wf_EmploymentHistory" class="wfSection required">
<legend>EXPERIENCE</legend>
<div class="htmlsection" id="html-tfa_wfEmploymentHist"><p>Please list most recent employer first</p></div>
<fieldset id="wf_Employer" class="repeat wfSection">
<legend>Employer<br />
</legend>
<table width="979" border="0" align="center">
  <tr>
    <td width="171">ORGANIZATION-1</td>
    <td width="4">&nbsp;</td>
    <td width="171"><input name="org" type="text" class="input" id="org" /></td>
    <td width="69">&nbsp;</td>
    <td width="110">DESIGNATION</td>
    <td width="166"><input name="des" type="text" class="input" id="des" /></td>
    <td width="1">&nbsp;</td>
    <td width="79">STATION</td>
    <td width="170"><input name="stat" type="text" class="input" id="stat" /></td>
  </tr>
  <tr>
    <td>DUTIES</td>
    <td>&nbsp;</td>
    <td><label>
      <textarea name="duty" class="input" id="duty"></textarea>
    </label></td>
    <td>&nbsp;</td>
    <td>FROM</td>
    <td><input name="from" type="text" class="input" id="from" /></td>
    <td>&nbsp;</td>
    <td>TO</td>
    <td><input name="to" type="text" class="input" id="to" /></td>
  </tr>
</table>
<legend></legend>
<span class="duplicateSpan"><a id="wf_Employer-wfDL" class="duplicateLink" href="#">Add another employer</a></span>
</fieldset>
</fieldset>
<div class="actions">
<input type="submit" class="primaryAction" id="submit-wf_EmploymentApplica" name="tfa_submitAction" value="submit"><input type="hidden" value="230783" name="tfa_dbFormId" id="tfa_dbFormId"><input type="hidden" value="" name="tfa_dbResponseId" id="tfa_dbResponseId"><input type="hidden" value="d7d1a627edc3bae97c19b0d1847edc68" name="tfa_dbControl" id="tfa_dbControl"><input type="hidden" value="1" name="tfa_dbVersionId" id="tfa_dbVersionId">
</div>
</form>
</div>

      </div>

connection.php

<?php

	$con = mysql_connect('localhost','root','');
	
	mysql_select_db('add',$con);




?>
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by cereal
0

The query is wrong, you wrote:

mysql_query("insert into exp values('$org','$des','$stat','$duty','$from','$to')");

But the database table does not know in which order and which fields you are requesting to be written, so change your code with this, or similar adapting to your database table:

mysql_query("insert into exp ('org','des','stat','duty','from','to') values('$org','$des','$stat','$duty','$from','$to')");

bye :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.