Advertisement

04.21.2008 at 09:57AM PDT, ID: 23340215
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

change static email address to become a variable depending on a specific customer..

Asked by memberfromuk in PHP Scripting Language, Web Languages/Standards, MySQL Server

Tags: , ,

Hi, i have a database which stores customer details (name, address, email address)...on my system i can 'assign' a risk address to a customer which when i do so, an email reciept gets sent to an email address which is static and is therefore obviously always the same address!!...

..is there anyone out there who could create this email address to be a variable based on a which customer is being added a 'riskaddress' ?

below is a sample of the WORKING code which emails the data within the fields from a form, to gssinsurance@googlemail.com - which i intend to get rid of, and create a variable email address.

P.S. Split into two pages - addriskaddress.php & addriskaddressform.phpStart Free Trial
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:
addriskaddress.php
 
<?php
session_start();
if (isset($_SESSION['username']) == false){
		header("Location:login.php");
		exit();
	}
	require "connect.php";
	$risk_address_no_name = $_GET['risk_address_no_name'];
	$risk_address1 = $_GET['risk_address1'];
	$risk_address2 = $_GET['risk_address2'];
	$risk_address_postcode = $_GET['risk_address_postcode'];
	$property_type = $_GET['property_type'];
	$year_built = $_GET['year_built'];
	$ownership_occupier = $_GET['ownership_occupier'];
	//$loss_of_rent_cover = $_GET['loss_of_rent_cover'];
	$mortgage_provider = $_GET['mortgage_provider'];
	$british_standard_security = $_GET['british_standard_security'];
	$recent_claims = $_GET['recent_claims'];
	$recent_claims_explanation = $_GET['recent_claims_explanation'];
	$customer_ref = $_GET['customer_ref'];
	
 
	
	$query = "insert into risk_address (risk_address_no_name, risk_address1, risk_address2, risk_address_postcode, property_type, year_built, ownership_occupier, mortgage_provider, british_standard_security, recent_claims, recent_claims_explanation, customer_ref) values ('".$risk_address_no_name."', '".$risk_address1."', '".$risk_address2."', '".$risk_address_postcode."', '".$property_type."', '".$year_built."', '".$ownership_occupier."', '".$mortgage_provider."', '".$british_standard_security."', '".$recent_claims."','".$recent_claims_explanation."', '".$customer_ref."')";
	
	
	
	require "emailserver.php";
 
$data="";
$data .= "\nNo. Name: " . (empty($_REQUEST['risk_address_no_name']) ? "" : $_REQUEST['risk_address_no_name']);
$data .= "\nAddress 1: " . (empty($_REQUEST['risk_address1']) ? "" : $_REQUEST['risk_address1']);
$data .= "\nAddress 2: " . (empty($_REQUEST['risk_address2']) ? "" : $_REQUEST['risk_address2']);
$data .= "\nPost Code: " . (empty($_REQUEST['risk_address_postcode']) ? "" : $_REQUEST['risk_address_postcode']);
$data .= "\nProperty Type: " . (empty($_REQUEST['property_type']) ? "" : $_REQUEST['property_type']);
$data .= "\nYear Built: " . (empty($_REQUEST['year_built']) ? "" : $_REQUEST['year_built']);
$data .= "\nOccupancy: " . (empty($_REQUEST['ownership_occupier']) ? "" : $_REQUEST['ownership_occupier']);
//$data .= "\nLoss of Rent Cover: " . (empty($_REQUEST['loss_of_rent_cover']) ? "" : $_REQUEST['loss_of_rent_cover']);
$data .= "\nMortgage Provider: " . (empty($_REQUEST['mortgage_provider']) ? "" : $_REQUEST['mortgage_provider']);
$data .= "\nBritish Standard Security: " . (empty($_REQUEST['british_standard_security']) ? "" : $_REQUEST['british_standard_security']);
$data .= "\nAny Claims In Past 5 Years?: " . (empty($_REQUEST['recent_claims']) ? "" : $_REQUEST['recent_claims']);
$data .= "\nCustomer Ref. :" . (empty($_REQUEST['customer_ref']) ? "" : $_REQUEST['customer_ref']); 
 
$to      = 'gssinsurance@googlemail.com';//customers email $email
$subject = 'Your Policy Details';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: info@gssinsurance.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion(); 
mail($to, $subject, $data, $headers);
	
	
	
	
	$result = @mysql_query($query, $connection) 
or die ("Unable to perform query<br>$query");
$risk_address_ref = mysql_insert_id($connection);
	header("Location: addpolicyform.php?risk_address_ref=$risk_address_ref&customer_ref=$customer_ref");
	
	
	exit();
?>
 
************************************************************************
addriskaddressform.php
________________________________________________________________________
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
session_start();
if (isset($_SESSION['username']) == false){
            header("Location:login.php");
            exit();
      }
      require "connect.php";
     
      $query = "select * from customer";
	   $query2 = "select * from customer";
      $customer_ref = $_GET['customer_ref'];
	  
      $result = @mysql_query($query, $connection)
 or die ("Unable to perform query<br>$query".mysql_error());
      //echo "customer_ref should appear here..".$customer_ref;
	  $result2 = @mysql_query($query2, $connection)
 or die ("Unable to perform query<br>$query".mysql_error());
	 
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GSS - Add Risk Address</title>
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
 
<!-- will show a textfield area if NO is selected-->
<script type="text/javascript">
function testClaimExplanation(selBox) {
  if(selBox == "Yes") {
    document.getElementById('recent_claims_explanation').style.display = "";
  } else {
    document.getElementById('recent_claims_explanation').style.display = "none";
  }
}
</script>
 
<style>
.error { color:red }
.normal { color:black }
</style>
 
<!--ensures textboxes are not empty-->
<script type="text/javascript">
function validate(theForm) {
  if (theForm.risk_address_no_name.value=="") {
    document.getElementById('riskname_label').className='error';
    alert("Please enter a name");
    theForm.risk_address_no_name.focus();
    return false
  }
  else {
    document.getElementById('riskname_label').className='normal';
  }
  if (theForm.risk_address1.value=="") {
    document.getElementById('riskaddr1_label').className='error';
    alert("Please enter an Address for line one");
    theForm.risk_address1.focus();
    return false
  }
  else {
    document.getElementById('riskaddr1_label').className='normal';
  }
 if (theForm.risk_address2.value=="") {
    document.getElementById('riskaddr2_label').className='error';
    alert("Please enter an Address for line two");
    theForm.risk_address2.focus();
    return false
  }
  else {
    document.getElementById('riskaddr2_label').className='normal';
  }
  if (theForm.risk_address_postcode.value=="") {
    document.getElementById('riskaddrpcode_label').className='error';
    alert("Please enter a Postcode");
    theForm.risk_address_postcode.focus();
    return false
  }
  else {
    document.getElementById('riskaddrpcode_label').className='normal';
  }
  if (theForm.property_type.value=="") {
    document.getElementById('propertytype_label').className='error';
    alert("Please enter a Property Type");
    theForm.property_type.focus();
    return false
  }
  else {
    document.getElementById('propertytype_label').className='normal';
  }
  if (theForm.year_built.value=="[Select One]") {
    document.getElementById('yearbuilt_label').className='error';
    alert("Please enter a Year Built");
    theForm.year_built.focus();
    return false
  }
  else {
    document.getElementById('yearbuilt_label').className='normal';
  }
  if (theForm.ownership_occupier.value=="[Select One]") {
    document.getElementById('occupier_label').className='error';
    alert("Please enter an Ownership Occupier");
    theForm.ownership_occupier.focus();
    return false
  }
  else {
    document.getElementById('occupier_label').className='normal';
  }
  
   if (theForm.mortgage_provider.value=="") {
    document.getElementById('mortgageprov_label').className='error';
    alert("Please enter a Mortgage Provider");
    theForm.mortgage_provider.focus();
    return false
  }
  else {
    document.getElementById('mortgageprov_label').className='normal';
  }
  return true;
}
</script>
 
 
 
</head>
<body>
<div id="header">
      <ul id="menu">
            <li><a href="home.php">Home</a></li>
            <li><a href="search_customer.php" accesskey="2" title="">Customers</a></li>
            <li><a href="reports.php" accesskey="3" title="">reports</a></li>
            <li><a href="search_policy.php" accesskey="4" title="">document management</a></li>
            <li><a href="emailform.php" accesskey="5" title="">email</a></li>
      </ul>
     
      <p style="font-family:verdana;font-size:110%;color:white">
 
</p>
</div>
 
<div id="submenu">
	<ul id="customerMenu">
		
		
		<?php $row= mysql_fetch_array($result2)?>
		<li><a href="customerview.php?customer_ref=<?php echo $row['customer_ref'];?>">Profile</a></li>
		
		
		
</ul></div>
<div id="content">
      <div id="colOne">
            <div id="logo">
                  <h1><a href="#">gss</a></h1>
                  <h2>insurance and property services </h2>
            </div>
            <div class="box">
              <ul class="bottom"><li></li>
                  </ul>
            </div>
            <div class="box">
                  <h3>&nbsp;</h3>
                  <ul class="bottom"><li></li>
                  </ul>
            </div>
      </div>
      <div id="colTwo">
       
        <p class="indent">
<h1 align="center">New Risk Address Details </h1>
 
<fieldset>
<legend><font size="4" face="Times">Details</font></legend>
<form action="addriskaddress.php" method="get" onSubmit="return validate(this)">
   <table width="400" border="0">
          <tr>
            <td><p><label id="riskname_label" for="riskname">No Name:</label><br /><input id="riskname" name="risk_address_no_name" type="text"></p></td>
            <td><label id="yearbuilt_label" for="yearbuilt">Year Built</label><br />
      <select id="yearbuilt" name="year_built">
        <option selected>[Select One]</option>
        <?php
$year = 1800;
$currentYear = date(Y);
 
while($year <= $currentYear)
{
 echo "<option value=\"".$year."\">".$year."</option>";
 $year++;
}
?>
      </select></td>
          </tr>
          <tr>
            <td><p><label id="riskaddr1_label" for="riskaddr1">Address Line 1:</label><br /><input id="riskaddr1" name="risk_address1" type="text"></p></td>
            <td><label id="occupier_label" for="occupier">Occupancy</label><br />
  <select id="occupier" name="ownership_occupier">
    <option selected>[Select One]</option>
    <option >Let on AST</option>
    <option >Let to DSS on AST</option>
    <option >Let to Asylum Seekers</option>
    <option >Vacant</option>
  </select></td>
          </tr>
          <tr>
            <td><p><label id="riskaddr2_label" for="riskaddr2">Address Line 2:</label><br /><input id="riskaddr2" name="risk_address2" type="text"></p></td>
            <td><p><label id="mortgageprov_label" for="mortgageprov">Mortgage Provider:</label><br/><input id="mortgageprov" name="mortgage_provider" type="text"></p></td>
          </tr>
          <tr>
            <td>
			<p><label id="riskaddrpcode_label" for="riskaddrpcode">Postcode:<br /></label><input id="riskaddrpcode" name="risk_address_postcode" type="text"></p>
			</td>
            <td><p>British Standard Security</label><br/>
  <select name="british_standard_security">
    <option >Yes</option>
    <option >No</option>
  </select></td>
          </tr>
          <tr>
            <td><p><label id="propertytype_label" for="propertytype">Property Type:</label><br /><input id="propertytype" name="property_type" type="text"></p></td>
            <td><p>Any Claims In Past 5 Years?</label><br />
  <select name="recent_claims" onchange="testClaimExplanation(this.options[this.selectedIndex].value);">
    <option value="Yes">Yes</option>
    <option value="No" selected="selected">No</option>
      </select></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><div id="recent_claims_explanation" style="display:none">
Please write down the details of your recent claims (max 1000 characters):<br />
<textarea name="recent_claims_explanation" rows="10" cols="60"></textarea>
</div></td>
          </tr>
      </table>
 
 
<input name="customer_ref" type="hidden" value="<?php echo $customer_ref; ?>" />
<input name="Save" type="submit" value="Save & Continue">
</form>
</fieldset>
 
</p></div>
</div>
<div id="footer">
      <p>Copyright (c) 2008 Joe Tzouvanni All rights reserved.</p>
</div>
</body>
</html>
[+][-]04.21.2008 at 10:13AM PDT, ID: 21403906

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 10:14AM PDT, ID: 21403919

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 10:16AM PDT, ID: 21403932

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 10:38AM PDT, ID: 21404154

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 10:53AM PDT, ID: 21404306

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 11:02AM PDT, ID: 21404397

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 11:11AM PDT, ID: 21404464

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, Web Languages/Standards, MySQL Server
Tags: php/MySQL, Dreamweaver 8, php 5.2.5 MySQL 5.0.45
Sign Up Now!
Solution Provided By: rowejd
Participating Experts: 4
Solution Grade: A
 
 
[+][-]04.21.2008 at 11:14AM PDT, ID: 21404490

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628