All pastes #475465 Raw Edit

Something

public php v1 · immutable
·published 2007-05-07 13:36 UTC
rendered paste body
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Edit: Quote</title><link href="datum.css" rel="stylesheet" type="text/css"></head><body><div id="container700"><table width="400" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F9F9F9">  <tr>    <td class="header2"><div align="center"><a href="accounts.php">ACCOUNTS</a></div></td>		<td class="header2"><div align="center"><a href="contacts.php">CONTACTS</a></div></td>		<td class="header2"><div align="center"><a href="quotes.php">QUOTES</a></div></td>	</tr></table><br><br><?php$quote_id = $_GET['quote_id'];$action = $_REQUEST['action'];$color1 = "#F5F9FE";$color2 = "#ECF1FD";// if SAVE button pressed, then do this:if ($action == "Save") {	$id = $_POST['id'];	$name = $_POST['name'];	$date_in = $_POST['date_in'];	$account_id = $_POST['account'];	$contact_id = $_POST['contact'];	$board_ref = $_POST['board_ref'];	$board_num = $_POST['board_num'];	$product_id = $_POST['product'];	$syntracote = $_POST['syntracote'];	$active = $_POST['active'];	$user_id = $_POST['user'];	$status_id = $_POST['status'];	$priority = $_POST['priority'];	$po_num = $_POST['po_num'];	$qty_ordered = $_POST['qty_ordered'];	$qty_shipped = $_POST['qty_shipped'];		// form the query and UPDATE the QUOTE info	include("db_connect.php");	$query="UPDATE opportunities SET id='$id', name='$name', date_in='$date_in', account_id='$account_id', contact_id='$contact_id', board_ref='$board_ref', board_num='$board_num', product_id='$product_id', syntracote='$syntracote', active='$active', user_id='$user_id', status_id='$status_id', priority='$priority', po_num='$po_num', qty_ordered='$qty_ordered', qty_shipped='$qty_shipped' WHERE id=$quote_id";	$result=mysql_query($query) or die(mysql_error());	mysql_close();	}// form the query for selecting info for the specific quoteinclude("db_connect.php");$query="SELECT * FROM OPPORTUNITIES WHERE id=$quote_id";$result=mysql_query($query) or die(mysql_error());mysql_close();while ($row = mysql_fetch_assoc($result)) {	$id = $row['id'];	$name = $row['name'];	$date_in = $row['date_in'];	$account_id = $row['account_id'];	$account_name = $row['account_name'];	$contact_id = $row['contact_id'];	$board_ref = $row['board_ref'];	$board_num = $row['board_num'];	$product_id = $row['product_id'];	$product_name = $row['product_name'];	$syntracote = $row['syntracote'];	$active = $row['active'];	$user_id = $row['user_id'];	$status_id = $row['status_id'];	$status_name = $row['status_name'];	$priority = $row['priority'];	$po_num = $row['po_num'];	$qty_ordered = $row['qty_ordered'];	$qty_shipped = $row['qty_shipped'];	}	?><form name="form1" method="post" action="<?php echo "$PHP_SELF"; ?>">	<table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#F9F9F9">		<tr><td colspan=4><div class=header3a>Quote: <?php if ($action == "Save") {echo " Saved";} elseif ($action == "Delete") {echo " Deleted";} else {echo " Not submitted";}?></div></td></tr>		<tr>			<td width="20%" class="table_label">Name:</td>			<td width="30%" class="table_text"><input name="name" type="text" class="stdtxtgrey" id="name" tabindex="1" value="<?php echo "$name"; ?>" size="25" maxlength="25"></td>			<td width="20%" class="table_label">Active:</td>			<td width="30%" class="table_text"><input name="active" type="checkbox" value="1" <?php if ($active==1) {echo "checked";} ?>></td>		</tr>		<tr>			<td class="nobrd_table_label">Date In :</td>			<td class="nobrd_table_text"><input name="date_in" type="text" class="stdtxtgrey" id="date_in" tabindex="1" value="<?php echo "$date_in"; ?>" size="25" maxlength="25"></td>			<td class="nobrd_table_label">Assigned to:</td>			<td class="nobrd_table_text">				<?php				// start and loop through all the accounts for the dropdown list				echo "<select name=user class=stdtxtgrey>";				// form the query for selecting info from accounts				include("db_connect.php");				$query="SELECT * FROM users";				$result = mysql_query($query);				mysql_close();				// loop through all records and populate dropdown list				while ($row = mysql_fetch_assoc($result)) {					$acc_id = $row['id'];					$acc_name = $row['user_name'];					echo "<option value='$acc_id'" . ($acc_id == $user_id ? ' selected' : '') . ">$acc_name</option>";					}				echo "</select>";				?>			</td>		</tr>		<tr>			<td class="nobrd_table_label">Account Name :</td>			<td class="nobrd_table_text">				<?php				// start and loop through all the accounts for the dropdown list				echo "<select name=account class=stdtxtgrey>";				// form the query for selecting info from accounts				include("db_connect.php");				$query="SELECT * FROM accounts ORDER BY name";				$result = mysql_query($query);				mysql_close();				// loop through all records and populate dropdown list				while ($row = mysql_fetch_assoc($result)) {					$acc_id = $row['id'];					$acc_name = $row['name'];					echo "<option value='$acc_id'" . ($acc_id == $account_id ? ' selected' : '') . ">$acc_name</option>";					}				echo "</select>";				?>			</td>			<td class="nobrd_table_label">Status:</td>			<td class="nobrd_table_text">				<?php				// start and loop through all the accounts for the dropdown list				echo "<select name=status class=stdtxtgrey>";				// form the query for selecting info from accounts				include("db_connect.php");				$query="SELECT * FROM status_types";				$result = mysql_query($query);				mysql_close();				// loop through all records and populate dropdown list				while ($row = mysql_fetch_assoc($result)) {					$acc_id = $row['id'];					$acc_name = $row['name'];					echo "<option value='$acc_id'" . ($acc_id == $status_id ? ' selected' : '') . ">$acc_name</option>";					}				echo "</select>";				?>			</td>		</tr>		<tr>			<td class="nobrd_table_label">Contact:</td>			<td class="nobrd_table_text">				<?php				// start and loop through all the accounts for the dropdown list				echo "<select name=contact class=stdtxtgrey>";				// form the query for selecting info from accounts				include("db_connect.php");				$query="SELECT * FROM contacts ORDER BY last_name";				$result = mysql_query($query);				mysql_close();				// loop through all records and populate dropdown list				while ($row = mysql_fetch_assoc($result)) {					$acc_id = $row['id'];					$acc_first = $row['first_name'];					$acc_last = $row['last_name'];					echo "<option value='$acc_id'" . ($acc_id == $contact_id ? ' selected' : '') . ">$acc_last, $acc_first</option>";					}				echo "</select>";				?>			</td>			<td class="nobrd_table_label">Priority:</td>			<td class="nobrd_table_text"><input name="priority" type="text" class="stdtxtgrey" id="priority" tabindex="1" value="<?php echo "$priority"; ?>" size="25" maxlength="25"></td>		</tr>		<tr>			<td class="nobrd_table_label">Board Ref :</td>			<td class="nobrd_table_text"><input name="board_ref" type="text" class="stdtxtgrey" id="board_ref" tabindex="1" value="<?php echo "$board_ref"; ?>" size="25" maxlength="25"></td>			<td class="nobrd_table_label">PO #:</td>			<td class="nobrd_table_text"><input name="po_num" type="text" class="stdtxtgrey" id="po_num" tabindex="1" value="<?php echo "$po_num"; ?>" size="25" maxlength="25"></td>		</tr>		<tr>			<td class="nobrd_table_label">Board # :</td>			<td class="nobrd_table_text"><input name="board_num" type="text" class="stdtxtgrey" id="board_num" tabindex="1" value="<?php echo "$board_num"; ?>" size="25" maxlength="25"></td>			<td class="nobrd_table_label">Qty Ordered:</td>			<td class="nobrd_table_text"><input name="qty_ordered" type="text" class="stdtxtgrey" id="qty_ordered" tabindex="1" value="<?php echo "$qty_ordered"; ?>" size="25" maxlength="25"></td>		</tr>		<tr>			<td class="nobrd_table_label">Product :</td>			<td class="nobrd_table_text">				<?php				// start and loop through all the accounts for the dropdown list				echo "<select name=product class=stdtxtgrey>";				// form the query for selecting info from accounts				include("db_connect.php");				$query="SELECT * FROM product_types";				$result = mysql_query($query);				mysql_close();				// loop through all records and populate dropdown list				while ($row = mysql_fetch_assoc($result)) {					$acc_id = $row['id'];					$acc_name = $row['name'];					echo "<option value='$acc_id'" . ($acc_id == $product_id ? ' selected' : '') . ">$acc_name</option>";					}				echo "</select>";				?>			</td>			<td class="nobrd_table_label">Qty Shipped:</td>			<td class="nobrd_table_text"><input name="qty_shipped" type="text" class="stdtxtgrey" id="qty_shipped" tabindex="1" value="<?php echo "$qty_shipped"; ?>" size="25" maxlength="25"></td>		</tr>		<tr>			<td class="nobrd_table_label">Syntracote:</td>			<td class="nobrd_table_text"><input name="syntracote" type="checkbox" value="1" <?php if ($syntracote==1) {echo " checked";} ?>></td>			<td class="nobrd_table_label"></td>			<td class="nobrd_table_text"></td>		</tr>	</table>	<div id="edit_buttons">		<input name="action" value="Delete" type="submit"/>		<input name="action" value="Save" type="submit"/>	</div></form></div></body></html>