Code: Select all
<?php
//session_start();
// check logged in or not
//if (!isset($_SESSION['db_is_logged_in'])
// || $_SESSION['db_is_logged_in'] !== true) {
// no...move to login page
// header('Location: index.php');
// exit;
//}
?>
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Companies Represented</title>
</head>
<body bgcolor="#EFEFEF">
<p align="left" style="margin-top:0px; margin-bottom:0px"> </p>
<?php
include("config.php");
include("opendb.php");
if(isset($_POST['submit']))
{//begin of $submit).
$exid = $_POST['exid'];
$name = $_POST['exhibit.name'];
$address = $_POST['address'];
$fax = $_POST['fax'];
$email = $_POST['email'];
$web = $_POST['web'];
$contact1 = $_POST ['contact1'];
$contact2 = $_POST ['contact2'];
$contact3 = $_POST ['contact3'];
$contact4 = $_POST ['contact4'];
$desc = $_POST ['desc'];
$name2 = $_POST[$name];
$rep = $_POST['rep'];
$product = $_POST['product'];
$result = "INSERT INTO exhibit (exid, name, address, phone, fax, email, web, contact1, contact2, contact3, contact4, desc) VALUES ('$exid', '$name', '$address', '$phone', '$fax', '$email', '$web', '$contact1', '$contact2', '$contact3', '$contact4', '$desc')";
print $result;
mysql_query($result,$connect);
//while($myrow = mysql_fetch_assoc($result))
// {
// $name = $_POST['name'];
foreach ($rep as $key => $repv) {
$SQL = "INSERT INTO companies (coid, name, rep, product) values ('$coid', '$name2', '$repv', '$product[$key]')";
print $SQL;
mysql_query($SQL, $connect);
}
//foreach($_REQUEST['rep'] as $rep) && foreach($_REQUEST['product'] as $product);
//mysql_query("INSERT INTO companies (coid, name, rep, product) values ('$coid', '$name2', '$rep', '$product')", $connect);
echo "<br><b>Thank you! Your information has been received successfully!";
}
// has the form been submitted?
else
{//begin of else
?>
<br />
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER[PHP_SELF] ?>">
<table width="700" border="1" align="left" cellpadding="2" cellspacing="2">
<tr>
<td width="150">Company Name</td>
<td><input name="name" type="text" id="name1" size="50"></td>
</tr>
<tr>
<td width="150">Address</td>
<td><input name="address" type="text" id="address" size="50"></td>
</tr>
<tr>
<td width="150">Phone</td>
<td><input name="phone" type="text" id="phone" size="50"></td>
</tr>
<tr>
<td width="150">Fax</td>
<td><input name="fax" type="text" id="fax" size="50"></td>
</tr>
<tr>
<td width="150">Email</td>
<td><input name="email" type="text" id="email" size="50"></td>
</tr>
<tr>
<td width="150">Website</td>
<td><input name="web" type="text" id="web" size="50"></td>
</tr>
<tr>
<td width="150">Primary Contact</td>
<td><input name="contact1" type="text" id="contact" size="50"></td>
</tr>
<tr>
<td width="150">Additional Contact</td>
<td><input name="contact2" type="text" id="contact2" size="50"></td>
</tr>
<tr>
<td width="150">Additional Contact</td>
<td><input name="contact3" type="text" id="contact3" size="50"></td>
</tr>
<tr>
<td width="150">Additional Contact</td>
<td><input name="contact4" type="text" id="contact4" size="50"></td>
</tr>
<tr>
<td width="150">General Description</td>
<td><input name="desc" size="50" type="text" id="desc"></td>
</tr>
<tr>
<td colspan="2"><br /><b>Please enter all the companies you represent with the products they provide:</b></td>
</tr>
<tr>
<td width="350">Company Represented</td>
<td>Products</td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[1]" type="text" size="30"></td>
<td><input name="product[1]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[2]" type="text" size="30"></td>
<td><input name="product[2]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[3]" type="text" size="30"></td>
<td><input name="product[3]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[4]" type="text" size="30"></td>
<td><input name="product[4]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[5]" type="text" size="30"></td>
<td><input name="product[5]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[6]" type="text" size="30"></td>
<td><input name="product[6]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[7]" type="text" size="30"></td>
<td><input name="product[7]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[8]" type="text" size="30"></td>
<td><input name="product[8]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[9]" type="text" size="30"></td>
<td><input name="product[9]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[10]" type="text" size="30"></td>
<td><input name="product[10]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[11]" type="text" size="30"></td>
<td><input name="product[11]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[12]" type="text" size="30"></td>
<td><input name="product[12]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[13]" type="text" size="30"></td>
<td><input name="product[13]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[14]" type="text" size="30"></td>
<td><input name="product[14]" type="text" size="75"></td>
</tr>
<tr>
<td><input name="name" type="hidden" value="<?php echo $myrow['name'] ?>"><input name="rep[15]" type="text" size="30"></td>
<td><input name="product[15]" type="text" size="75"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="submit"></td>
</tr>
</table>
</form>
<?php
//}
} //end of else
?>
</body>
</html>