Question

Passing List/Menu Records to Update Page Using PHP and Dreamweaver

Asked by: phpNovice

I can't believe I'm having so much trouble with this but I'm here in defeat and looking for mercy.  I set up a Master Detail Page Set in Dreamweaver CS3 and had it create a Detail Page for me like it does so well.  What I've done in the past (and this time) is used the Update Record Form Wizard to create an update page on the detail page.  I find this works well because I can "call" the DetailRS1 recordset to populate the fields and then when I click on a record in the master detail page it takes me to the detail page with the update form.  I usually end up deleting the detail form because it is redundant and I deleted it in this case as well.  

Now I have a detail/update page that is displaying and updating all of the fields properly expect for four menu/list drop downs that for the life of me I can't get to display the correct values initially (the values that are currently stored in the database).  It's driving me bananas.  I have other form fields, even radio groups that are populating perfectly fine.  Below is the code to one of the menu drop downs.  It contains a list of years for car makes.  I have a couple of recordsets that I'm pulling data from but all I want is to have the correct year initially selected in the drop down.  I don't care how it gets there.  Thanks in advance for your help.

If you need more info let me know.  The code on this page is very lengthy so I think I should refrain from posting it all.  

<select name="tradeYear">
        <?php
do {  
?>
        <option value="<?php echo $row_RecordsetTradeInYear['Year']?>"<?php if (!(strcmp($row_RecordsetTradeInYear['Year'], htmlentities($row_DetailRS1['tradeYear'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecordsetTradeInYear['Year']?></option>
        <?php
} while ($row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear));
  $rows = mysql_num_rows($RecordsetTradeInYear);
  if($rows > 0) {
      mysql_data_seek($RecordsetTradeInYear, 0);
	  $row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear);
  }
?>
      </select>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-31 at 02:39:18ID24616187
Tags

dreamweaver

,

php

,

web page

,

forms

Topics

Adobe Dreamweaver

,

Miscellaneous Web Development

,

PHP and Databases

Participating Experts
2
Points
500
Comments
29

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Dreamweaver PHP Recordset problem
    When trying to create a Recordset (under the Bindings tab in Dreamweaver 8) in a php page, I get the error: The Recordset script does not define the applyServerBehavior function I'm running Dreamweaver 8, Win 2003 Server, IIS 6, PHP 5.2, MySQL 5.0.27. I've installed Interak...
  2. Dreamweaver recordset
    When you create dreamweaver recordset Is it have a tolol to sumation in some colum
  3. Combining Recordsets in Dreamweaver
    How do I combine two recordsets into one in Dreamweaver? (MX2004) I am using PHP and MYSQL. Explanation: This is an events page. I have two recordsets, each one is pulling information from two identical tables located in separate databases (different connections), combining...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: racmail2001Posted on 2009-07-31 at 03:31:12ID: 24987540

try to replace your code with this

<select name="tradeYear">
<?php
 
$query="Select ...";
$RecordsetTradeInYear=mysql_query($query);
 
 while ($row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear)){
 
 echo'<option value="'.$row_RecordsetTradeInYear['Year'];
 echo (!(strcmp($row_RecordsetTradeInYear['Year'], htmlentities($row_DetailRS1['tradeYear'], ENT_COMPAT, 'UTF-8'))))?'selected="selected"':"";
 echo $row_RecordsetTradeInYear['Year']."</option>";
  
 }
 
?>
      </select>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:

Select allOpen in new window

 

by: phpNovicePosted on 2009-07-31 at 08:26:37ID: 24989667

Hi racmail2001 -

I just plugged that code in and the drop down is not displaying anything.  I will look at more closely this morning.

Thanks!

 

by: jason1178Posted on 2009-07-31 at 09:47:58ID: 24990505

phpNovice,

Can you send a link to the Master page so I can test the behavior?

 

by: racmail2001Posted on 2009-07-31 at 13:22:37ID: 24992121

be sure to place the correct $query="Select ...";

i putted that only to show you where to change it.

in your script you did not had a query ... so i did not know what to place there

 

by: phpNovicePosted on 2009-08-01 at 18:48:36ID: 24997448

Hello,

I just redid the whole master page and detail page and added the update page again.  It works now.  Not sure what was going on the first time around but it works now and I'm in my happy place again.  Thanks for your help everyone!

 

by: phpNovicePosted on 2009-08-02 at 00:57:51ID: 24998035

Back again, thought it was working but it isn't.  Now, some fields are updating and not others.  Any ideas why all of the plain text box fields always populate correctly but the drop downs don't always pull the correct data.  I thought it might have something to do with session variables but I played with that and it doesn't appear to be the case.  How much code would you like to see?  

 

by: jason1178Posted on 2009-08-02 at 01:00:52ID: 24998045

>> How much code would you like to see?  

All of it.

 

by: phpNovicePosted on 2009-08-02 at 01:14:15ID: 24998076

Here's the master page code:

<?php
$tfmsqlstr = "";
if (isset($_POST["searchID"]) || isset($_GET["searchID"])){
  $tfm_searchField = (isset($_POST["searchID"]))?$_POST["searchID"]:$_GET["searchID"];
  if($tfm_searchField != "") {
    $tfm_andor = "AND";
    $tfm_exact = "false";
    $bellChar = chr(7);
    $tfmsqlstr = " WHERE ((";
    $tfm_databaseFields = explode(",","lastName,quoteDate,firstName,phone,phoneAlt,address,city,state,zip,email,stockNumberOld,tradeYear,tradeMake,tradeModel,lienholder,acctNum,payoffAmt,tradeACV,oldPayment,stockNumberNew,quotedMake,quotedModel,quotedYear,newPayment,paymentDiff,followUpLetterNotes,followUpCallNotes,apptScheduledNotes,notes,custID");    
    if ((strstr($tfm_searchField,'"')) || ($tfm_exact == "true")){ 
       $tfm_searchField = str_replace('"','',$tfm_searchField); 
       $tfm_andor = "OR";
    }else 
    if (stristr($tfm_searchField," or ")){ 
      $tfm_searchField = preg_replace('/\s+or\s+/i',$bellChar,$tfm_searchField);
      $tfm_andor = "OR";
    }else  
    if (strstr($tfm_searchField,',') || strstr($tfm_searchField,' ') || stristr(strtolower($tfm_searchField),' and ')) { 
      $tfm_searchField = preg_replace("/\s+and\s+/i",$bellChar,$tfm_searchField);
      $tfm_searchField = str_replace(",",$bellChar,$tfm_searchField);
      $tfm_searchField = str_replace(" ",$bellChar,$tfm_searchField);
    }
    $splitField = explode($bellChar,$tfm_searchField);
    for ($i = 0; $i < sizeof($splitField) ;$i++){
      for ($j = 0; $j < sizeof($tfm_databaseFields); $j++){
        $tfmsqlstr = $tfmsqlstr."(".$tfm_databaseFields[$j]." LIKE '%".str_replace("'","''",$splitField[$i])."%')"; 
        if ($j < sizeof($tfm_databaseFields)-1) $tfmsqlstr = $tfmsqlstr." OR "; 
      }
      if ($i < sizeof($splitField) -1) $tfmsqlstr = $tfmsqlstr.") ".$tfm_andor." (";
    }
    $tfmsqlstr = $tfmsqlstr."))";
  }else{
    $tfmsqlstr = " WHERE 1=1 ";
  }
}else{
  $tfmsqlstr = " WHERE 1=1 ";
}
?>
<?php require_once('../../Connections/mydatabase.php'); ?>
<?php
$tfm_orderby =(!isset($_GET["tfm_orderby"]))?"custID":$_GET["tfm_orderby"];
$tfm_order =(!isset($_GET["tfm_order"]))?"ASC":$_GET["tfm_order"];
$sql_orderby = " " .$tfm_orderby." ".$tfm_order;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
if (isset($_POST['lastName']) && !empty($_POST['lastName'])) {
  session_start();
    $_SESSION['salutation'] = $_POST['salutation'];
	$_SESSION['lastName'] = $_POST['lastName'];
	$_SESSION['firstName'] = $_POST['firstName'];
	$_SESSION['quotedYear'] = $_POST['quotedYear'];
	$_SESSION['quotedModel'] = $_POST['quotedModel'];
	$_SESSION['newPayment'] = $_POST['newPayment'];
	$_SESSION['oldPayment'] = $_POST['oldPayment'];
	$_SESSION['tradeYear'] = $_POST['tradeYear'];
	$_SESSION['tradeModel'] = $_POST['tradeModel'];
	
}
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
 
 
$sqlorderby_Recordset1 = "custID";
if (isset($sql_orderby)) {
  $sqlorderby_Recordset1 = $sql_orderby;
}
// Defining List Recordset variable
$tfmsqlstr_Recordset1 = " WHERE 1=1 ";
if (isset($tfmsqlstr)) {
  $tfmsqlstr_Recordset1 = $tfmsqlstr;
}
// Defining List Recordset variable
$sqlorderby_Recordset1 = "custID";
if (isset($sql_orderby)) {
  $sqlorderby_Recordset1 = $sql_orderby;
}
mysql_select_db($database_mydatabase, $mydatabase);
 
$query_Recordset1 = "SELECT *, newPayment-oldPayment AS difference FROM contacts {$tfmsqlstr_Recordset1}  ORDER BY $sql_orderby";
$Recordset1 = mysql_query($query_Recordset1, $mydatabase) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
 
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<?php
 
$tfm_saveParams = explode(",","");
$tfm_keepParams = "";
if($tfm_order == "ASC") {
	$tfm_order = "DESC";
}else{
	$tfm_order = "ASC";
};
while (list($key,$val) = each($tfm_saveParams)) {
	if(isset($_GET[$val]))$tfm_keepParams .= ($val)."=".urlencode($HTTP_GET_VARS[$val])."&";	
	if(isset($_POST[$val]))$tfm_keepParams .= ($val)."=".urlencode($HTTP_POST_VARS[$val])."&";
}
$tfm_orderbyURL = $HTTP_SERVER_VARS["PHP_SELF"]."?".$tfm_keepParams."tfm_order=".$tfm_order."&tfm_orderby=";
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>All Records</title>
<link href="anthony.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<div id="form_list_all">
  <div id="searchBox">
    <form action="" method="post" name="form1" class="formText" id="form1">
      <label>
      <input name="searchID" type="text" class="formText" id="searchID" size="32" />
      </label>
      <label>
      <input name="button" type="submit" class="formText" id="button" value="Search Records" />
      </label>
      <label></label>
      <input name="button2" type="submit" class="formText" id="button2" value="Clear Search Results" />
    </form>
    <br />
  </div>
  <table border="1" align="center" class="formText">
    <tr>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>custID">Client ID</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>quoteDate">Date</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>salutation">Salutation</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>firstName">First Name</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>lastName">Last Name</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>phoneAlt">Cell Phone</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>phone">Home Phone</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>tradeYear">Trade-In Year</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>tradeMake">Trade-In Make</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>tradeModel">Trade-In Model</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>quotedYear">New Car Year</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>quotedMake">New Car Make</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>quotedModel">New Car Model</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>followUpLetter">Follow Up <br />
        Letter Sent</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>followUpCall">Follow Up <br />
        Call Made</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>apptScheduled">Appointment <br />
        Scheduled</a></td>
      <td><a href="<?Php echo ($tfm_orderbyURL); ?>difference">Payment <br />
        Difference</a></td>
    </tr>
    <?php do { ?>
    <tr>
      <td><a href="record_detail.php?recordID=<?php echo $row_Recordset1['custID']; ?>"> <?php echo $row_Recordset1['custID']; ?>&nbsp; </a> </td>
      <td><?php echo $row_Recordset1['quoteDate']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['salutation']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['lastName']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['firstName']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['phone']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['phoneAlt']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['tradeYear']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['tradeMake']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['tradeModel']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['quotedYear']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['quotedMake']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['quotedModel']; ?>&nbsp;</td>
      <td><?php echo $row_Recordset1['followUpLetter']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['followUpCall']; ?>&nbsp; </td>
      <td><?php echo $row_Recordset1['apptScheduled']; ?>&nbsp; </td>
      <td><?php echo ($row_Recordset1['difference'] < 0) ? '<span style="color:red;">' . $row_Recordset1['difference'] . '</span>' : $row_Recordset1['difference']; ?>&nbsp; </td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  </table>
  
  <table border="0" class="formText">
    <tr>
      <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
          <?php } // Show if not first page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
          <?php } // Show if not first page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
          <?php } // Show if not last page ?>
      </td>
      <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
          <?php } // Show if not last page ?>
      </td>
    </tr>
  </table>
  <span class="formText">Records <?php echo ($startRow_Recordset1 + 1) ?> to <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?></span><br />
</div>
<br />
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:

Select allOpen in new window

 

by: phpNovicePosted on 2009-08-02 at 01:15:19ID: 24998081

Here's the update page code:

<?php
if (isset($_POST['lastName']) && !empty($_POST['lastName'])) {
  session_start();
    $_SESSION['salutation'] = $_POST['salutation'];
	$_SESSION['lastName'] = $_POST['lastName'];
	$_SESSION['firstName'] = $_POST['firstName'];
	$_SESSION['quotedYear'] = $_POST['quotedYear'];
	$_SESSION['quotedModel'] = $_POST['quotedModel'];
	$_SESSION['newPayment'] = $_POST['newPayment'];
	$_SESSION['oldPayment'] = $_POST['oldPayment'];
	$_SESSION['tradeYear'] = $_POST['tradeYear'];
	$_SESSION['tradeModel'] = $_POST['tradeModel'];
	
}
?>
<?php require_once('../../Connections/mydatabase.php'); ?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE contacts SET quoteDate=%s, salutation=%s, lastName=%s, firstName=%s, phone=%s, phoneAlt=%s, address=%s, city=%s, `state`=%s, zip=%s, email=%s, stockNumberOld=%s, `tradeYear`=%s, tradeMake=%s, tradeModel=%s, lienholder=%s, acctNum=%s, payoffAmt=%s, tradeACV=%s, oldPayment=%s, stockNumberNew=%s, quotedYear=%s, quotedMake=%s, quotedModel=%s, newPayment=%s, followUpLetter=%s, followUpLetterNotes=%s, followUpCall=%s, followUpCallNotes=%s, apptScheduled=%s, apptScheduledNotes=%s, notes=%s WHERE custID=%s",
                       GetSQLValueString($_POST['quoteDate'], "text"),
                       GetSQLValueString($_POST['salutation'], "text"),
                       GetSQLValueString($_POST['lastName'], "text"),
                       GetSQLValueString($_POST['firstName'], "text"),
                       GetSQLValueString($_POST['phone'], "text"),
                       GetSQLValueString($_POST['phoneAlt'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['city'], "text"),
                       GetSQLValueString($_POST['state'], "text"),
                       GetSQLValueString($_POST['zip'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['stockNumberOld'], "text"),
                       GetSQLValueString($_POST['tradeYear'], "text"),
                       GetSQLValueString($_POST['tradeMake'], "text"),
                       GetSQLValueString($_POST['tradeModel'], "text"),
                       GetSQLValueString($_POST['lienholder'], "text"),
                       GetSQLValueString($_POST['acctNum'], "text"),
                       GetSQLValueString($_POST['payoffAmt'], "text"),
                       GetSQLValueString($_POST['tradeACV'], "text"),
                       GetSQLValueString($_POST['oldPayment'], "text"),
                       GetSQLValueString($_POST['stockNumberNew'], "text"),
                       GetSQLValueString($_POST['quotedYear'], "text"),
                       GetSQLValueString($_POST['quotedMake'], "text"),
                       GetSQLValueString($_POST['quotedModel'], "text"),
                       GetSQLValueString($_POST['newPayment'], "text"),
                       GetSQLValueString($_POST['followUpLetter'], "text"),
                       GetSQLValueString($_POST['followUpLetterNotes'], "text"),
                       GetSQLValueString($_POST['followUpCall'], "text"),
                       GetSQLValueString($_POST['followUpCallNotes'], "text"),
                       GetSQLValueString($_POST['apptScheduled'], "text"),
                       GetSQLValueString($_POST['apptScheduledNotes'], "text"),
                       GetSQLValueString($_POST['notes'], "text"),
                       GetSQLValueString($_POST['custID'], "int"));
 
  mysql_select_db($database_mydatabase, $mydatabase);
  $Result1 = mysql_query($updateSQL, $mydatabase) or die(mysql_error());
 
  $updateGoTo = "complete.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
 
$maxRows_DetailRS1 = 100;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
  $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
 
$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
  $colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_mydatabase, $mydatabase);
$query_DetailRS1 = sprintf("SELECT * FROM contacts WHERE custID = %s", GetSQLValueString($colname_DetailRS1, "int"));
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $mydatabase) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
 
if (isset($_GET['totalRows_DetailRS1'])) {
  $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
  $all_DetailRS1 = mysql_query($query_DetailRS1);
  $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
 
mysql_select_db($database_mydatabase, $mydatabase);
$query_Recordset4 = "SELECT * FROM makes";
$Recordset4 = mysql_query($query_Recordset4, $mydatabase) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
 
mysql_select_db($database_mydatabase, $mydatabase);
$query_RecordsetStates = "SELECT * FROM `states`";
$RecordsetStates = mysql_query($query_RecordsetStates, $mydatabase) or die(mysql_error());
$row_RecordsetStates = mysql_fetch_assoc($RecordsetStates);
$totalRows_RecordsetStates = mysql_num_rows($RecordsetStates);
 
mysql_select_db($database_mydatabase, $mydatabase);
$query_RecordsetYear = "SELECT * FROM year";
$RecordsetYear = mysql_query($query_RecordsetYear, $mydatabase) or die(mysql_error());
$row_RecordsetYear = mysql_fetch_assoc($RecordsetYear);
$totalRows_RecordsetYear = mysql_num_rows($RecordsetYear);
 
mysql_select_db($database_mydatabase, $mydatabase);
$query_RecordsetNewCarYear = "SELECT * FROM year";
$RecordsetNewCarYear = mysql_query($query_RecordsetNewCarYear, $mydatabase) or die(mysql_error());
$row_RecordsetNewCarYear = mysql_fetch_assoc($RecordsetNewCarYear);
$totalRows_RecordsetNewCarYear = mysql_num_rows($RecordsetNewCarYear);
 
mysql_select_db($database_mydatabase, $mydatabase);
$query_RecordsetTradeInYear = "SELECT * FROM year";
$RecordsetTradeInYear = mysql_query($query_RecordsetTradeInYear, $mydatabase) or die(mysql_error());
$row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear);
$totalRows_RecordsetTradeInYear = mysql_num_rows($RecordsetTradeInYear);
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Client Information Update</title>
<link href="anthony.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <div id="form">
    <table align="center" class="formText">
      <tr valign="baseline">
        <td width="177" class="headerText">Client Information</td>
      <td width="166">&nbsp;</td>
        <td width="163" class="formTextRed">Client ID: <?php echo $row_DetailRS1['custID']; ?></td>
      </tr>
      <tr valign="baseline">
        <td>Date (mm/dd/yyyy)</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="quoteDate" value="<?php echo htmlentities($row_DetailRS1['quoteDate'], ENT_COMPAT, 'UTF-8'); ?>" size="10" /></td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>Salutation (Mr., Mrs., Ms.)</td>
        <td>First Name</td>
        <td>Last Name</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="salutation" value="<?php echo htmlentities($row_DetailRS1['salutation'], ENT_COMPAT, 'UTF-8'); ?>" size="10" /></td>
      <td><input type="text" name="firstName" value="<?php echo htmlentities($row_DetailRS1['firstName'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td><input type="text" name="lastName" value="<?php echo htmlentities($row_DetailRS1['lastName'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      </tr>
      <tr valign="baseline">
        <td>Address</td>
      <td>City</td>
        <td>State Zip</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="address" value="<?php echo htmlentities($row_DetailRS1['address'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td><input type="text" name="city" value="<?php echo htmlentities($row_DetailRS1['city'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td><select name="state">
          <?php
do {  
?>
          <option value="<?php echo $row_RecordsetStates['abb']?>"<?php if (!(strcmp($row_RecordsetStates['abb'], htmlentities($row_DetailRS1['state'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecordsetStates['abb']?></option>
          <?php
} while ($row_RecordsetStates = mysql_fetch_assoc($RecordsetStates));
  $rows = mysql_num_rows($RecordsetStates);
  if($rows > 0) {
      mysql_data_seek($RecordsetStates, 0);
	  $row_RecordsetStates = mysql_fetch_assoc($RecordsetStates);
  }
?>
        </select> <input type="text" name="zip" value="<?php echo htmlentities($row_DetailRS1['zip'], ENT_COMPAT, 'UTF-8'); ?>" size="5" /></td>
      </tr>
      <tr valign="baseline">
        <td>Cell Phone</td>
        <td>Home Phone</td>
        <td>Email</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="phoneAlt" value="<?php echo htmlentities($row_DetailRS1['phoneAlt'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      <td><input type="text" name="phone" value="<?php echo htmlentities($row_DetailRS1['phone'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td><input type="text" name="email" value="<?php echo htmlentities($row_DetailRS1['email'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      </tr>
      <tr valign="baseline">
        <td colspan="2" class="headerText">Trade-In Information</td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>Trade-In Stock Number</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="stockNumberOld" value="<?php echo htmlentities($row_DetailRS1['stockNumberOld'], ENT_COMPAT, 'UTF-8'); ?>" size="17" /></td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>Trade-In Year</td>
      <td>Trade-In Make</td>
        <td>Trade-In Model</td>
      </tr>
      <tr valign="baseline">
        <td><select name="tradeYear">
          <?php
do {  
?>
          <option value="<?php echo $row_RecordsetTradeInYear['Year']?>"<?php if (!(strcmp($row_RecordsetTradeInYear['Year'], htmlentities($row_DetailRS1['tradeYear'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecordsetTradeInYear['Year']?></option>
          <?php
} while ($row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear));
  $rows = mysql_num_rows($RecordsetTradeInYear);
  if($rows > 0) {
      mysql_data_seek($RecordsetTradeInYear, 0);
	  $row_RecordsetTradeInYear = mysql_fetch_assoc($RecordsetTradeInYear);
  }
?>
        </select></td>
      <td><select name="tradeMake">
        <?php
do {  
?>
        <option value="<?php echo $row_Recordset4['makes']?>"<?php if (!(strcmp($row_Recordset4['makes'], $row_DetailRS1['tradeMake']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset4['makes']?></option>
        <?php
} while ($row_Recordset4 = mysql_fetch_assoc($Recordset4));
  $rows = mysql_num_rows($Recordset4);
  if($rows > 0) {
      mysql_data_seek($Recordset4, 0);
	  $row_Recordset4 = mysql_fetch_assoc($Recordset4);
  }
?>
      </select></td>
        <td><input type="text" name="tradeModel" value="<?php echo htmlentities($row_DetailRS1['tradeModel'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      </tr>
      <tr valign="baseline">
        <td>Lienholder</td>
      <td>Account Number</td>
        <td>Payoff Amount</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="lienholder" value="<?php echo htmlentities($row_DetailRS1['lienholder'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      <td><input type="text" name="acctNum" value="<?php echo htmlentities($row_DetailRS1['acctNum'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td><input type="text" name="payoffAmt" value="<?php echo htmlentities($row_DetailRS1['payoffAmt'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      </tr>
      <tr valign="baseline">
        <td>Trade-In ACV</td>
      <td>Current Payment</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="tradeACV" value="<?php echo htmlentities($row_DetailRS1['tradeACV'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      <td><input type="text" name="oldPayment" value="<?php echo htmlentities($row_DetailRS1['oldPayment'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2" class="headerText">New Car Information </td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>New Car Stock Number</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="stockNumberNew" value="<?php echo htmlentities($row_DetailRS1['stockNumberNew'], ENT_COMPAT, 'UTF-8'); ?>" size="17" /></td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>New Car Year</td>
      <td>New Car Make</td>
        <td>New Car Model</td>
      </tr>
      <tr valign="baseline">
        <td><select name="quotedYear">
          <?php
do {  
?>
          <option value="<?php echo $row_RecordsetNewCarYear['Year']?>"<?php if (!(strcmp($row_RecordsetNewCarYear['Year'], htmlentities($row_DetailRS1['quotedYear'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecordsetNewCarYear['Year']?></option>
          <?php
} while ($row_RecordsetNewCarYear = mysql_fetch_assoc($RecordsetNewCarYear));
  $rows = mysql_num_rows($RecordsetNewCarYear);
  if($rows > 0) {
      mysql_data_seek($RecordsetNewCarYear, 0);
	  $row_RecordsetNewCarYear = mysql_fetch_assoc($RecordsetNewCarYear);
  }
?>
        </select></td>
      <td><select name="quotedMake">
        <?php
do {  
?>
        <option value="<?php echo $row_Recordset4['makes']?>"<?php if (!(strcmp($row_Recordset4['makes'], htmlentities($row_DetailRS1['quotedMake'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset4['makes']?></option>
        <?php
} while ($row_Recordset4 = mysql_fetch_assoc($Recordset4));
  $rows = mysql_num_rows($Recordset4);
  if($rows > 0) {
      mysql_data_seek($Recordset4, 0);
	  $row_Recordset4 = mysql_fetch_assoc($Recordset4);
  }
?>
      </select></td>
        <td><input type="text" name="quotedModel" value="<?php echo htmlentities($row_DetailRS1['quotedModel'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      </tr>
      <tr valign="baseline">
        <td>New Car Payment</td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="text" name="newPayment" value="<?php echo htmlentities($row_DetailRS1['newPayment'], ENT_COMPAT, 'UTF-8'); ?>" size="20" /></td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
            <td class="headerText">Follow Up </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2">Follow Up Letter Sent:
          <label>
          <input type="radio" name="followUpLetter" value="Yes <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?>" />
  Yes</label>
          <label>
          <input type="radio" name="followUpLetter" value="No" <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"No"))) {echo "CHECKED";} ?> />
  No</label></td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2"><textarea name="followUpLetterNotes" cols="40" rows="3"><?php echo htmlentities($row_DetailRS1["followUpLetterNotes"], ENT_COMPAT, 'UTF-8'); ?></textarea></td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2">Follow Up Call Made:
          <input type="radio" name="followUpCall" value="Yes <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpCall"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?>" />
  Yes
  <input type="radio" name="followUpCall" value="No" <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"No"))) {echo "CHECKED";} ?>  />
  No</td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2"><textarea name="followUpCallNotes" cols="40" rows="3"><?php echo htmlentities($row_DetailRS1["followUpCallNotes"], ENT_COMPAT, 'UTF-8'); ?></textarea></td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2">Scheduled Appointment:
          <label>
          <input type="radio" name="apptScheduled" value="Yes" <?php if (!(strcmp(htmlentities($row_DetailRS1["apptScheduled"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?> />
  Yes</label>
          <label>
          <input type="radio" name="apptScheduled" value="No" <?php if (!(strcmp(htmlentities($row_DetailRS1["apptScheduled"], ENT_COMPAT, 'UTF-8'),"No"))) {echo "CHECKED";} ?> />
  No</label></td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2" valign="baseline"><textarea name="apptScheduledNotes" cols="40" rows="3"><?php echo htmlentities($row_DetailRS1["apptScheduledNotes"], ENT_COMPAT, 'UTF-8'); ?></textarea></td>
        <td valign="baseline">&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2">Additional Notes      </td>
      <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td colspan="2" valign="baseline"><textarea name="notes" cols="40" rows="3"><?php echo htmlentities($row_DetailRS1["notes"], ENT_COMPAT, 'UTF-8'); ?></textarea></td>
        <td valign="baseline">&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td>&nbsp;      </td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr valign="baseline">
        <td><input type="submit" value="Update record" /></td>
      <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
  </div>
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="custID" value="<?php echo $row_DetailRS1['custID']; ?>" />
</form>
<p>&nbsp;</p>
</body>
</html><?php
mysql_free_result($DetailRS1);
 
mysql_free_result($Recordset4);
 
mysql_free_result($RecordsetStates);
 
mysql_free_result($RecordsetYear);
 
mysql_free_result($RecordsetNewCarYear);
 
mysql_free_result($RecordsetTradeInYear);
?>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:

Select allOpen in new window

 

by: phpNovicePosted on 2009-08-04 at 17:03:21ID: 25019333

Now, it appears that two of the radio button groups are not pulling from the database as expected.  Any ideas would be helpful...

 

by: jason1178Posted on 2009-08-04 at 17:27:48ID: 25019424

In the detail page, you are attempting to set session variables if a post variable exist.  But the master page is not posting to the detail...just linking.  Not sure if it's an issue, but you should probably remove it if it isn't supposed to be there.

>> Any ideas why all of the plain text box fields always populate correctly but the drop downs don't
>> always pull the correct data.

It could be related to this:

<option value="<?php echo $row_Recordset4['makes']?>"<?php if (!(strcmp($row_Recordset4['makes'], htmlentities($row_DetailRS1['quotedMake'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset4['makes']?></option>

You are attempting to match text with HTML entities and UTF-8 encoding and that could cause the failure to associate the stored value with the list value.  

Are you storing formatted text in the database?

>> Now, it appears that two of the radio button groups are not pulling from the database as expected.

Same deal:

 <input type="radio" name="followUpLetter" value="Yes <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?>" />

 

by: phpNovicePosted on 2009-08-04 at 22:11:41ID: 25020318

Jason -

When a user clicks on the update button on the detail page, they're taken to the next page where those session variables are used.  I think I need to keep them in there.

Dreammweaver helped me create this monster :) :

<option value="<?php echo $row_Recordset4['makes']?>"<?php if (!(strcmp($row_Recordset4['makes'], htmlentities($row_DetailRS1['quotedMake'], ENT_COMPAT, 'UTF-8')))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset4['makes']?></option>

I don't have formatted text in my database.  If I can use something other than htmlentities and UTF-8 in this string please tell me what you think might work.

Thanks :)
Brent

 

by: jason1178Posted on 2009-08-04 at 23:01:34ID: 25020485

>> they're taken to the next page where those session variables are used.  I think I need to keep them in
>> there.

No, all you would need is:

if (!session_id()) session_start();

Once the session variables are assigned, all you need is the above code to have them available to that page.  You don't need to reset them each time.  Besides, your current code on the detail page is looking for a post action.  It will never evaluate so you are wasting bytes.

>> Dreammweaver helped me create this monster :) :

It may be because you are using UTF-8 encoding on the pages (which isn't strictly needed).  The calls should look more like this:

 <option value="<?php echo $row_Recordset4['makes']?>"<?php if (!(strcmp($row_Recordset4['makes'], $row_DetailRS1['quotedMake']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset4['makes']?></option>

In other words, just remove

, ENT_COMPAT, 'UTF-8'

from the above and see if it works better.  If you still don't have agreement between the detail recordset and options, you need to double check to see if the values are being pulled properly.  I would also consider removing the UTF-8 line:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

and rebuilding the dynamic lists.

 

by: phpNovicePosted on 2009-08-05 at 01:49:58ID: 25021255

"and rebuilding the dynamic lists."

Where should the data in the update form be coming from?  Dreamweaver defaults to DetailRS1 but is that the best recordset to be using?  Should I create another recordset and include all of the fields in my database and try pulling from there?  

 

by: phpNovicePosted on 2009-08-05 at 01:51:41ID: 25021263

Also what's the difference between using double quotation marks " " and single quotation marks ' '?  

 

by: jason1178Posted on 2009-08-05 at 10:38:48ID: 25025979

>> Dreamweaver defaults to DetailRS1 but is that the best recordset to be using?

You need to use whatever recordset contains the detail row.  So long as the data is coming into the regular input boxes correctly, the DetailRS1 is fine.  The problem seems to be with creating the correct lookup tables for the other fields.

>> Should I create another recordset and include all of the fields in my database and try pulling from there?

See above.  You should not have to do this.

>> Also what's the difference between using double quotation marks " " and single quotation marks ' '?  

In HTML?  None.  In PHP, variables inside of a double-quote will be evaluated. So:

<?php echo "$somevar" ?>

Should produce whatever is stored in $somevar

<?php echo '$somevar' ?>

will produce the text $somevar

 

by: phpNovicePosted on 2009-08-05 at 11:34:00ID: 25026594

Upon further inspection it appears my database is using the following: MySQL charset:  UTF-8 Unicode (utf8)

Also, the MySQL connection collation is set to utf8_unicode_ci

I'm using PHP 5.

It doesn't appear I can remove/change the UTF-8 Unicode character set only change the collation.  Should the collation be set to something different?

 

by: phpNovicePosted on 2009-08-05 at 11:38:05ID: 25026630

The question about the " " and ' ' arose from the fact that I have this string for a text box:

<input type="text" name="newPayment" value="<?php echo htmlentities($row_DetailRS1['newPayment'], ENT_COMPAT, 'UTF-8'); ?>" size="20" />

and this for the radio group:

<input type="radio" name="followUpLetter" value="Yes" <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?> />

 

by: jason1178Posted on 2009-08-05 at 11:39:30ID: 25026641

I would set collation to anything in the Latin 1 set...

 

by: jason1178Posted on 2009-08-05 at 11:40:40ID: 25026650

>> and this for the radio group:

The 'UTF-8' is in single quotes because you don't want that evaluated as UTF minus 8

 

by: phpNovicePosted on 2009-08-05 at 12:09:07ID: 25026906

For the text box ['newPayment'] is in single quotes and in the radio group ["followUpLetter"] is in double quotes.  Is this OK?

 

by: jason1178Posted on 2009-08-05 at 12:17:25ID: 25026982

>> For the text box ['newPayment'] is in single quotes and in the radio group ["followUpLetter"] is in double quotes.

It's fine.  The reason for this is the text box has external double quotes from the value="" so the inner quotes are changed to single to avoid a problem with closing the quotes too soon.

value="<?php echo htmlentities($row_DetailRS1['newPayment'], ENT_COMPAT, 'UTF-8'); ?>" size="20" />

The radio has no external quotes, so double works there:

<input type="radio" name="followUpLetter" value="Yes" <?php if (!(strcmp(htmlentities($row_DetailRS1["followUpLetter"], ENT_COMPAT, 'UTF-8'),"Yes"))) {echo "CHECKED";} ?> />

 

by: phpNovicePosted on 2009-08-07 at 11:55:17ID: 25045865

Jason (and all) -

OK, I'm still having issues and am about to re-do both the master page and detail page.  I'm also going to re-create the database.  Should my database be encoded with Latin1?  I have a choice but it defaults to UTF-8.  Also, when setting up my page initially, is there anything that comes to mind that I should ensure are present that I may not have had before?

 

by: jason1178Posted on 2009-08-07 at 11:58:59ID: 25045896

>>  Should my database be encoded with Latin1?

Unless you are going to support foreign alphabets, encode in Latin1

>> Also, when setting up my page initially, is there anything that comes to mind that I should ensure are present
>> that I may not have had before?

Go slow.  Build the master page, add the recordset there, then build the detail page with the detail recordset without any of the other recordsets or dynamic form elements.  Make sure each thing is working before adding the next thing.

 

by: phpNovicePosted on 2009-08-08 at 00:04:39ID: 25048609

Rebuilt everything, so far so good.  Every text field seemed to have html encoding for some reason.  It must be defaulted in my settings somewhere.  Plus, in my database, all of my fields were varchar and not text.  Would that matter?

 

by: jason1178Posted on 2009-08-08 at 07:19:08ID: 25049930

Varchar is fine as is htmlentities(). The UTF is what I think was throwing you off.

 

by: phpNovicePosted on 2009-08-08 at 11:11:09ID: 25051095

Thanks Jason -

I think my final dilema is how to to have two buttons on the update page, one button that takes you back to the master page users came from and one page that takes you to another page in the site.  However, when a user clicks either of the buttons any info on the page that was change needs to be updated in the database.  Any ideas how I could do this?  

 

by: jason1178Posted on 2009-08-08 at 13:24:11ID: 25051566

You should treat that as a different question...

 

by: phpNovicePosted on 2009-08-08 at 14:53:32ID: 25051906

I posted it yesterday with this title:

Button to Update Page and go to examplepage.php OR examplepage2.php

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...