i want to pass the value of $company_name=$_POST[‘company_name’];
$prepare_by=$_POST[‘prepare_by’];
$email=$_POST[‘email’];
$emp_1=$_POST[‘emp_1’];
$designation=$_POST[‘designation’];
$department=$_POST[‘department’]; using variable…can anyone help me…tahnks in advanced
[php]
<?php
session_start();
include "db1.php";
include "id_generator.php"
?>
<SCRIPT language=JavaScript type=text/JavaScript>
function check_entry()
{
if (form1.purpose.value=="") {
alert("Please Enter Purpose !");form1.purpose.focus();return false;
} else {
if (form1.pay_to.value=="") {
alert("Please Enter Pay To !");form1.pay_to.focus();return false;
} else {
if (form1.emp_2.value=="") {
alert("Please Enter Employee Number!");form1.emp_2.focus();return false;
} else {
if (form1.ecer.value=="") {
alert("Please eneter Ecer!");form1.ecer.focus();return false;
} else {
form1.submit()
}
}
}
}
}
</script>
<?php
if (isset($_REQUEST['add'])){
if (!$_REQUEST['company_name'] || !$_REQUEST['selectmanager'] || !$_REQUEST['purpose'] || !$_REQUEST['pay_to'] || !$_REQUEST['emp_2'] || !$_REQUEST['ecer'])
{
$display = "<font face='Verdana' font size='2' font color='#FF0000'> *Please Insert All The Particular";
echo $display;
}
else{
$t_id=$_REQUEST['t_id'];
$rec_id=date('r');
$company_name=$_POST['company_name'];
$prepare_by=$_POST['prepare_by'];
$email=$_POST['email'];
$emp_1=$_POST['emp_1'];
$designation=$_POST['designation'];
$department=$_POST['department'];
$selectmanager=$_REQUEST['selectmanager'];
$purpose=$_REQUEST['purpose'];
$pay_to=$_REQUEST['pay_to'];
$emp_2=$_REQUEST['emp_2'];
$ecer=$_REQUEST['ecer'];
//insert records
$query = "INSERT INTO voucher(t_id,rec_id,company_name,prepare_by,email,emp_1,designation,department,selectmanager,purpose,pay_to,emp_2,ecer)
values('$t_id','$rec_id','$company_name','$prepare_by','$email','$emp_1','$designation','$department','$selectmanager','$purpose','$pay_to','$emp_2','$ecer')";
$result=mysql_query($query) or die(mysql_error());
$msg="New Record Succesfully Saved ";
header("location:detail_2.php?msg=$msg&t_id=$t_id");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
h3{background-color:#CCCCCC;}
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>detail.php</title>
<link href="payment.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" name="form1" method="post" action="" onSubmit="return check_entry(this);return confirm('Are you want to save the E-Payment Voucher details ?nnWARNING:nTotal amount must more or equal to RM100.00n You cannot open E-Payment Voucher for total amount less than RM100.00 !!')" onclick="" >
<table width="545" height="10" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><? //echo $msg=$_REQUEST['msg'];?></td>
</tr>
<tr>
<td colspan="2">
<div align="left" class="style4">TRANSACTION CODE:
<input type="hidden" name="t_id" value="<? echo $t_id; ?>" />
<? echo $t_id;?>
</div></td>
</tr>
<tr>
<tr>
<td width="200"><span class="style3">Company Name </span></td>
<td width="345"><span class="style3">
<select name="company_name" size="1" id="company_name" />
<?php
$sql = "select *from callout";
$query = mysql_query($sql);
$countData = mysql_num_rows($query);?>
<?php while ($nt=mysql_fetch_array($query))
{
echo "<option>$nt[company] </option> ";
}?>
<br />
</span></td>
</tr>
<tr>
<td><span class="style3">Date</span></td>
<td><span class="style3">
<?php
echo date("d/m/Y");
?>
</span></td>
</tr><br />
<tr>
<td><span class="style3">Time</span></td>
<td><span class="style3">
<?php
echo date ("g:i a");
?>
</span></td>
</tr>
<tr>
<td><span class="style3">Prepare by</span></td>
<td><input name="prepare_by" disabled="disabled" value="<? $sql10="Select * from employee where ID ='$_SESSION[username]'";
$query10 = mysql_query($sql10) or die (mysql_error());
$result10 = mysql_fetch_assoc($query10);
echo $result10['Name'];
?>" /></td>
</tr>
<tr>
<td><span class="style3">Email Address</span></td>
<td><span class="style1">
<input name="email" disabled="disabled" value="<? $sql10="Select * from employee where ID ='$_SESSION[username]'";
$query10 = mysql_query($sql10) or die (mysql_error());
$result10 = mysql_fetch_assoc($query10);
echo $result10['email'];
?>" />
</span></td>
</tr>
<tr>
<td><span class="style3">Employee No</span></td>
<td>
<input name="emp_1" disabled="disabled" value="<? $sql10="Select * from employee where ID ='$_SESSION[username]'";
$query10 = mysql_query($sql10) or die (mysql_error());
$result10 = mysql_fetch_assoc($query10);
echo $result10['ID'];
?>" /></td>
</tr>
<tr>
<td>
<span class="style3">Designation</span></td>
<td>
<input name="designation" disabled="disabled" type="text" id="designation" value="<? $sql10="Select * from employee where ID ='$_SESSION[username]'";
$query10 = mysql_query($sql10) or die (mysql_error());
$result10 = mysql_fetch_assoc($query10);
echo $result10['Designation'];
?>" /></td>
</tr>
<tr>
<td>
<span class="style3">Department</span></td>
<td
><input name="department" type="text" disabled="disabled" id="department" value="<? $sql10="Select * from employee where ID ='$_SESSION[username]'";
$query10 = mysql_query($sql10) or die (mysql_error());
$result10 = mysql_fetch_assoc($query10);
echo $result10['Department'];
?>"/></td>
</tr>
<tr>
<td>
<span class="style3">Section/Dept Manager</span></td>
<td>
<span class="style1">
<select name="selectmanager" size="1" id="selectmanager" />
<?php
$sql = "select *from employee where jb_grade like 'M%'";
$query = mysql_query($sql);
$countData = mysql_num_rows($query);?>
<?php while ($nt=mysql_fetch_array($query))
{
echo "<option>$nt[Name] </option> ";
}?>
</span></td>
</tr>
</table>
<h3>Voucher details</h3>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200"><span class="style3">Purpose</span></td>
<td width="200"><textarea name="purpose" id="purpose"></textarea></td>
</tr>
<tr>
<td><span class="style3">Pay To</span></td>
<td><input type="text" name="pay_to" id="pay_to"></td>
</tr>
<tr>
<td><span class="style3">Company/Employee No</span></td>
<td><input type="text" name="emp_2" id="emp_2" /></td>
</tr>
<tr>
<td><span class="style3">E-Purchase#/E-CER#</span></td>
<td><input type="text" name="ecer" id="ecer" /></td>
</tr>
</table>
<p>
<input id="add" type="submit" value="Add Item" onclick="main.php" name="add" />
<input name="reset" type="reset" value="Reset" />
</p>
<p> </p>
</form>
</body>
</html>
[/php]
can anyone give me one example how to pass value to variable according to my coding…thank you…