Hi!
Looking for some direction as to how to do what I want... I have a script which allows me to add a salesperson to a database with info such as name, email address, cell #, etc.. This info gets saved once submitted. The names of the salespeople populate a dropdown list on another page. This second page I select other options, and submit it for a final "order", which is displayed on a third page.
My question: How can I display all of the fields which I filled on on the first page on the third page, when that particular salesperson is selected? Right now all that gets displayed is the name, but I would like all the other info (email, phone #, etc) to be displayed along with the name.
How may I accomplish this?
Relevant code below
This is the code to add a salesperson:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
$connect= mysql_connect("localhost","*****","*****")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
?>
<html>
<head>
<title>Add an account manager</title>
</head>
<body>
<form name="form3" method="post" action="acctmgr_added.php">
<TABLE BORDER WIDTH="100%">
<TR>
<TD>Account Manager Name:</TD> <TD><input type=text name="acctmgr_name" size=40></TD>
</TR>
<TR>
<TD>Phone Number:</TD> <TD><input type=text name="acctmgr_phone" size=11></TD>
</TR>
<TR>
<TD>Cell:</TD> <TD><input type=text name="acctmgr_cellphone" size=11></TD>
</TR>
<TR>
<TD>Email Address:</TD> <TD><input type=text name="acctmgr_email" size=30></TD>
</TR>
<TR>
<TD COLSPAN=2><input type="submit" name="Submit" value="Submit" action="required"></TD></FORM>
</TR>
</TABLE>
</body>
</html>
This is the code where the information is submitted to the database:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>accoutn manager added!</title>
</head>
<body>
<?php
$connect= mysql_connect("localhost","*****","*****")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$joined = date("Y-m-d h:i:s");
$sqlquery = "INSERT INTO acctmgr VALUES('','". $acctmgr_name ."','". $acctmgr_phone ."','". $acctmgr_cellphone ."','". $acctmgr_email ."','". $joined ."')";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$sqlquery = "SELECT * from acctmgr";
echo "<table border=1 align=center width=500>";
echo " <tr> ";
echo " <td > ";
echo " ID Number";
echo " </td>";
echo " <td > ";
echo mysql_insert_id(); // will print the number used in last successful insert
echo " </td > ";
echo " </tr>";
echo " <tr> ";
echo " <td > ";
echo " Account Manager Name";
echo " </td>";
echo " <td>".$acctmgr_name."</td>";
echo " </tr>";
echo " <tr> ";
echo " <td> ";
echo " Phone Number";
echo " </td>";
echo " <td>".$acctmgr_phone. "</td>";
echo " </tr>";
echo " <tr> ";
echo " <td > ";
echo " Cell";
echo " </td>";
echo " <td >".$acctmgr_cellphone. "</td>";
echo " </tr>";
echo " <tr> ";
echo " <td > ";
echo " Email Address";
echo " </td>";
echo " <td >".$acctmgr_email. "</td>";
echo " </tr>";
echo " <tr> ";
echo " <td > ";
echo " Timestamp";
echo " </td>";
echo " <td>".$joined."</td>";
echo " </tr>";
echo "</table>";
?>
Add another record <a href="http://localhost/add_acctmgr.php">LINK</a>
</body>
</html>
This is a code snippet where I select the salesperson:
<tr><!-- ROW 6, TABLE 2 -->
<td valign="top"><small><b><font face="Arial">Account Manager</font></b></small></td>
<td><select name="dropdownacctmgr" tabindex="4"><option value="notset">- Select an account manager -</option>
<?
//--- CREATE Account Manager SELECT ---
$sql = "SELECT DISTINCT acctmgr_name FROM acctmgr ORDER BY acctmgr_name";
$acctmgr_name = mysql_query($sql) or die($sql . '<br />' . mysql_error());
while ($row = mysql_fetch_array($acctmgr_name)) {
echo '<option value="' . $row['acctmgr_name'] . '">' . $row['acctmgr_name'] . '</option>';
}
?>
</td>
</tr>
This is a snippet of code from where the final information would be viewed. Don't mind the commented out part, I did that so I could view the table formatting without gettig the PHP and SQL errors:
<?php
//$connect= mysql_connect("localhost","root","cpyter")
// or die("Could not connect to database in localhost !");
//$result=mysql_select_db("testdiw")
// or die("Could not select that database !");
//$joined = date("Y-m-d h:i:s");
//
//$sqlquery = "INSERT INTO diw VALUES('','". $diwtitle ."','". $joined ."','". $dropdowndeponent ."')";
//
//
//$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
//$sqlquery = "SELECT * from diw";
echo '<table border=1 align=center width=500>
<tr>
<td colspan=2>General Deposition Information</td>
</tr>
<tr>
<td > DIW Number</td>
<td >' . mysql_insert_id() . '</td>
</tr>
<tr>
<td > DIW Title</td>
<td>' .$diwtitle. '</td>
</tr>
<tr>
<td > Todays Date</td>
<td>' .$joined. '</td>
</tr>
<tr>
<td> Deponent</td>
<td>' .$dropdowndeponent. '</td>
</tr>
<tr>
<td>Service Sold:</td>
<td>' .$service1. '</td>
</tr>
<tr>
<td>Post-Deposition Work:</td>
<td>Videography: ' .$service2. '<BR>' .$formattingvid. 'Syncronization: ' .$service3. '<BR>' .$formattingsync. '<BR>Audio Tapes Requested By Client:' .$service4. '<br>Other post-production work (please specify): ' .$otherservices. '<BR>I-DEP contracted Court Reporting Services needed?: ' .$service5. '<BR>Party(s) Remotely Deposing Witness?' .$remotedepose. '<BR>Save Video File?' .$savevideo. '</td>
<tr>
<td> Account Manager</td>
<td>' .$dropdownacctmgr. '</td>
</tr>