Re: insert data in to columns base on the selection of the list box.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
  bedul,
   
  This is what I need (don't worry about the variable names since they are different from my previous email.)
  
 <?php
  

$page_title = 'Update Current Data';
include ('./includes/header.html');
  include( '../mysql_connect.php' );
$tbl_name="lodata"; // Table name
echo'<form>';
  
   $query = "SELECT  Assign_Engineer FROM lodata";
   $result = mysql_query($query);
echo"<br>";
  echo"<br>";
echo"<center>";
  
echo"<select NAME='R'>";
echo"<option value='NULL'>Choose Name :</option>
";
   while ($line = mysql_fetch_array($result))
   {
      foreach ($line as $value)
       {
         echo"<OPTION value='$value'";
      }
echo ">$value</OPTION>";
  
   }
  
echo "</SELECT>";
echo "</form>";
  
 echo'<form name="data" method="post" action="ucd.php">';
if (isset($_POST['Submit'])) { .
   
  
if (eregi ('^[[:alpha:]\.\' \-]{2,15}$', stripslashes(trim($_POST['Job_Title'])))) {
  $jt = escape_data($_POST['Job_Title']);
 } else {
  $jt = FALSE;
  echo '<p><font color="red" size="+1">Please enter Job Descriptions!</font></p>';
 }
   if (eregi ('^[[:digit:]\.\' \-]{2,15}$', stripslashes(trim($_POST['ManhourSpent'])))) {
   $mhs = escape_data($_POST['ManhourSpent']);
  } else {
   $mhs = FALSE;
   echo '<p><font color="red" size="+1">Please enter Man hour Spent!</font></p>';
 }
  
 if (eregi ('^[[:alpha:]\.\' \-]{2,15}$', stripslashes(trim($_POST['Status'])))) {
    $stat = escape_data($_POST['Status']);
   } else {
    $stat = FALSE;
    echo '<p><font color="red" size="+1">Please enter Status!</font></p>';
 }
if ($jt && $mhs && $stat) {
  
$sql="UPDATE $tbl_name SET Job_Title = CONCAT(Job_Title, '$_POST[Job_Title]'),CONCAT(ManhourSpent, '$_POST[ManhourSpent]'),CONCAT(Status, '$_POST[Status]') WHERE Assign_Engineer ='SAR'";
  
$result=mysql_query($sql);
  
if($result){
echo "Your data have been submitted";
echo "<BR>";
  }
  else {
echo "ERROR.Please Try Again.";echo "<BR>" . mysql_error();
}
   
  
}
  }
  echo "<br>";
  echo "<br>";
echo "<br>";
  echo"<table width='500' border='0' align='center' cellpadding='0' cellspacing='1' bordercolor= 'CDCB98'>";
echo"<tr>";
echo"<td>";
  
echo"<table width='90%' border='1' cellspacing='1' cellpadding='3' bordercolor= 'CDCB98'>";
  
echo"<tr>";
echo"<td>Job Title/Description</td>";
  echo"<td>";
echo'<textarea name="Job_Title" type="text" id="Job_Title" cols="30" rows="6"></textarea>';
echo"</td>";
echo"</tr>";
echo"<tr>";
  
echo"<tr>";
echo"<td>Manhour  Spent</td>";
  echo"<td>";
echo'<input name="ManhourSpent" type="text" id="ManhourSpent">';
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td>Status/Comments</td>";
  echo"<td>";
echo'<textarea name="Status" type="text" id="Status" cols="30" rows="6"></textarea>';
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td colspan='3' align='center'>";
echo'<input class="sub" type="submit" name="Submit" value="Submit Data">';
echo"</td>";
echo"</tr>";
echo"</table>";
echo"</form>";
echo"</td>";
echo"</tr>";
echo"</table>";
mysql_close();
   
   
   
  echo'<CENTER>';
include ('./includes/footer.html');
echo'</CENTER>';
?>




 

 
---------------------------------
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux