| solidsoul | 5th April 2012 01:51 PM | Re: PHP SOLUTION NEEDED client_notes.php PHP Code: <?php include ("connect.php"); $id = $_GET['id'];
//this if statement will be used to change the messages to read //if they are not read and are considered NEW they will be RED //if they are marked READ they will be BLUE if (isset($_GET['read'])); { $read = $_GET['read'];
if ($read=yes) { $sql = "UPDATE `notes` SET `action`=$read, WHERE `notes`.`client_id`=0"; } } if (isset($_POST['submit'])) { $message = $_POST['message']; $date = date("F j, Y"); $client_id = $_GET['client_id']; $mess_id = rand();
$insert = mysql_query("INSERT INTO `notes` VALUES ('$client_id','$mess_id','$date','$user','$message','')") or die (mysql_error()); if ($insert) { echo "<div align='center'><font color='red'>Note Added Successfully Please Close Popup Now!</font></div>"; exit(); } }
//Client Notes - Should pull up notes related to client selected by ID ?> <table align="center" border="1"> <tr> <th>DATE</th> <th>USER</th> <th>MESSAGE</th> <th>ACTION</th> </tr> <?php $query = mysql_query("SELECT * FROM `notes` WHERE client_id=$id") or die("Sorry Mate Couldn't select datbase" . mysql_error()); while ($row=mysql_fetch_array($query)) { $num_row = mysql_num_rows($query); if ($num_row > 0) { echo "<tr><td>" . $row['date'] . "</td><td>" . $row['user'] . "</td><td>" . $row['message'] . "</td><td><a href='client_notes.php?read=yes&mess_id=".$row['mess_id']."'><div align='center'><img border='0' src='images/checkmark.gif' width='45' height='45'></a></div></td></tr>"; } else { echo "No Messages To Produce"; } } echo "</table>"; ?> <div align="center"> <form action="client_notes.php?client_id=<?php echo $id; ?>" method="POST"> <fieldset id="Add_Notes"> <legend>ADD NOTES</legend> <label for="message">Message:</label> <textarea cols="30" rows="5" name="message"> </textarea> <input id="button1" type="submit" name="submit" value="ADD" /> </form> </div> index.php where the view notes link is located PHP Code: <?php include("connect.php"); $username = "Desjardins"; ?> <!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>Fitzgerald Motors Client Management System</title> <meta name="keywords" content="cms,cmr,client management system,fitzgerald motors" /> <meta name="description" content="Metal Full Site Template is provided by templatemo.com" /> <link href="templatemo_style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Language" content="en-us" />
<meta name="author" content="Niall Doherty" />
<script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script> <script src="js/jquery-easing.1.2.pack.js" type="text/javascript"></script> <script src="js/jquery-easing-compatibility.1.2.pack.js" type="text/javascript"></script> <script src="js/coda-slider.1.1.1.pack.js" type="text/javascript"></script>
<!-- The CSS. You can of course have this in an external .css file if you like. Please note that not all these styles may be necessary for your use of Coda-Slider, so feel free to take out what you don't need. -->
<!-- Initialize each slider on the page. Each slider must have a unique id --> <script type="text/javascript"> jQuery(window).bind("load", function() { jQuery("div#slider1").codaSlider() // jQuery("div#slider2").codaSlider() // etc, etc. Beware of cross-linking difficulties if using multiple sliders on one page. }); </script> <script type="text/javascript"> var GB_ROOT_DIR = "http://www.site.com/cms/greybox/"; </script> <script type="text/javascript" src="greybox/AJS.js"></script> <script type="text/javascript" src="greybox/AJS_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script> <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" />
</head> <body> <style type="text/css"> div.scroll { height: 270px; width: 660px; overflow: auto; border: 1px solid #666; background-color: #ccc; padding: 8px; }
label {font-family:Arial, Helvetica, sans-serif; display:inline-block;} legend {font-size:16px; font-family:"Arial Black", Gadget, sans-serif; padding:2em 2em 2em 2em; } #formwrapper {width:680px; background:#36F; margin:2em auto 0 auto; padding:2em 0 2em 0; border:solid 5px #00C; } </style> <div id="templatemo_site_title_bar_wrapper"> <div id="templatemo_site_title_bar">
<div id="site_title"> <h1><a href="http://www.templatemo.com" target="_parent"> <img src="images/logo.png" alt="CSS Templates" /> <span> </span>
</a></h1> </div>
</div> <!-- end of templatemo_site_title_bar --> </div> <!-- end of templatemo_site_title_bar_wrapper -->
<div id="templatemo_content_wrapper"> <div id="templatemo_content">
<!-- start of slider -->
<div class="slider-wrap"> <div id="slider1" class="csw"> <div class="panelContainer">
<div class="panel" title="Home"> <div class="wrapper">
<h2>Welcome, <?php echo $username; ?></h2> <div class="date"> <?php echo date("F j, Y"); ?> </div>
<!--This is the home panel--> <div class="image_wrapper fl_image"> <img src="images/CMS-image.jpg" alt="image"/> </div> <div> System was created to give the financial dept of fitzgerald motors a better structure to tracking and following up on current and future leads.<br /><br />Below are key features built into CMS v1.0 and a quick tuorial on how to use.<br /> <div align="left"> <ul> <li>Add/Remove Clients</li> <li>Submit System Notes Per Client</li> <li>Ping Users / Message Users</li> <li>Set / Add / Remove Client Alerts</li> </ul> </div>
<br /> If you have any comments, question or concerns feel free to submit a system ticket or speak directly to the king of cars.
<div class="cleaner_h20"></div></div>
<p><a href="#2" class="cross-link" title="Go to Page 2">Next »</a></p> </div> </div> <div class="panel" title="Clients"> <div class="wrapper">
<h2>Current Clients</h2>
<!--This is the Clients Panel--> <table align="center" border="1"> <tr> <th>NAME</th> <th>PHONE</th> <th>SIN</th> <th>STOCK#</th> <th>BANK APPROVAL</th> <th>NOTES</th> </tr> <?php $results = mysql_query("SELECT * FROM `clients`") or die(mysql_error()); while ($row = mysql_fetch_array($results)) { $num_results = mysql_num_rows($results); if ($num_results > 0) {
echo "<tr><td>" . $row['fname'] . $row['lname'] . "</td><td>" . $row['phone1'] . "</td><td>" . $row['sin'] . "</td><td>" . $row['stock_num'] . "</td><td>" . $row['bank_approval'] . "</td><td><a href='http://www.site.com/cms/client_notes.php?id=".$row['id']."'title='client_notes' rel='gb_page_center[800, 400]'>View Notes</td></tr>";
} else { echo "Nothing it must be empty mate"; } }
echo "</table>"; ?>
<div align="center"><A HREF="javascript:history.go(0)">Click to refresh the page</A></div> <div class="cleaner_h20"></div> <p><a href="#1" class="cross-link" title="Go to Page 1">« Previous</a> | <a href="#3" class="cross-link" title="Go to Page 3">Next »</a></p> </div> </div>
<div class="panel" title="Add/Remove"> <div class="wrapper">
<h2>Add/Remove Clients</h2> <!--This is the Add Remove Section--> <?php //first lets check to see if the user is already in the system
//check to see if the form button was pressed //Things to add life insurance yes or no //who do you bank with currently if (isset($_POST['submit'])) { $fname = $_POST['fname']; $lname = $_POST['lname']; $sin = $_POST['sin']; $phone1 = $_POST['phone1']; $phone2 = $_POST['phone2']; $street_address = $_POST['street_address']; $city = $_POST['city']; $prov = $_POST['prov']; $postal = $_POST['postal']; $email = $_POST['email']; $home_status = $_POST['home_status']; $home_long = $_POST['home_long']; $home_payment = $_POST['home_payment']; $home_holder = $_POST['home_holder']; $bank_mortgage = $_POST['bank_mortgage']; $home_value = $_POST['home_value']; $home_owe = $_POST['home_owe']; $employer = $_POST['employer']; $e_address = $_POST['e_address']; $e_phone = $_POST['e_phone']; $e_howlong = $_POST['e_howlong']; $e_wageperhour = $_POST['e_wageperhour']; $e_hoursperweek = $_POST['e_hoursperweek']; $e_status = $_POST['e_status']; $insuracne_company = $_POST['insurance_company']; $i_phone = $_POST['i_phone']; $i_policy = $_POST['i_policy']; $stock_num = $_POST['stock_num']; $bank_approval = $_POST['bank_approval']; //29 varibles $query = mysql_query("SELECT * FROM `clients` WHERE sin=$sin"); if (mysql_num_rows($query) !=0 ) { echo "<div align='center'><font color='red'>That User Is Already Assocaited With An Account Please Search Our Listings Idiot.</font></div>"; } else { $insert= mysql_query("INSERT INTO `clients` (fname,lname,sin,phone1,phone2,street_address,city,prov,postal,email,home_status,home_long,home_payment,home_holder,bank_mortgage,home_value,home_owe,employer,e_address,e_phone,e_howlong,e_wageperhour,e_hoursperweek,e_status,insurance_company,i_phone,i_policy,stock_num,bank_approval) VALUES ('$fname','$lname','$sin','$phone1','$phone2','$street_address','$city','$prov','$postal','$email','$home_status','$home_long','$home_payment','$home_holder','$bank_mortgage','$home_value','$home_owe','$employer','$e_address','$e_phone','$e_howlong','$e_wageperhour','$e_hoursperweek','$e_status','$insuracne_company','$i_phone','$i_policy','$stock_num','$bank_approval')"); } if ($insert) { echo "<div align='center'><font color='red'>Listing added Successfully, Thanks</font></div>"; echo "<br />";
} else { echo "<div align='center'><font color='red'>I'm Sorry That Entry Was Not Added Correctly " . mysql_error() . " Please Try Again</font></div>"; } } //check to see if the submit button was pressed
if (isset($_POST['add_x'])) { //show the conect according to this button ?>
<div id="formwrapper"> <div class="scroll"> <form id="application" action="index.php#3" method="POST"> <fieldset id="personal"> <legend>PERSONAL INFORMATION</legend> <label for="firstname">First Name : </label> <input name="fname" id="fname" type="text" tabindex="1" />
<label for="lastname">Last Name : </label> <input name="lname" id="lastname" type="text" tabindex="2" />
<label for="sin">Sin # : </label> <input name="sin" id="sin" type="text" tabindex="3" />
<label for="phone1">Primary Phone : </label> <input name="phone1" id="phone1" type="text" tabindex="4" />
<label for="phone2">Cell Number : </label> <input name="phone2" id="phone2" type="text" tabindex="5" />
<label for="address">Address : </label> <input name="street_address" id="address" type="text" tabindex="6" />
<label for="city">City : </label> <input name="city" id="city" type="text" tabindex="7" />
<label for="prov">Prov : </label> <input name="prov" id="prov" type="text" tabindex="8" />
<label for="postal">Postal : </label> <input name="postal" id="postal" type="text" tabindex="9" />
<label for="email">Email : </label> <input name="email" id="name" type="text" tabindex="10" />
</fieldset> <fieldset>
<legend>HOME INFORMATION</legend> <label for="home_status">Rent Or Own : </label> <input name="home_status" id="home_status" type="text" tabindex="11" />
<label for="home_payment">How Much Rent/Mrtg Payments : </label> <input name="home_payment" id="home_payment" type="text" tabindex="12" />
<label for="home_holder">Bank or Landlord : </label> <input name="home_holder" id="home_holder" type="text" tabindex="13" />
<label for="bank_holder">Who Holds Mortgage : </label> <input name="bank_holder" id="bank_holder" type="text" tabindex="14" />
<label for="home_value">Home Value : </label> <input name="home_value" id="home_value" type="text" tabindex="15" />
<label for="home_owe">How Much Is Owning : </label> <input name="home_owe" id="home_owe" type="text" tabindex="16" />
</fieldset> <fieldset> <legend>Employment Information</legend> <label for="employer">Employer : </label> <input name="employer" id="employer" type="text" tabindex="17" />
<label for="e_address">Employer's Address : </label> <input name="e_address" id="e_address" type="text" tabindex="18" />
<label for="e_phone">Employer's Phone : </label> <input name="e_phone" id="e_phone" type="text" tabindex="19" />
<label for="e_howlong">How Long Employer : </label> <input name="e_howlong" id="e_howlong" type="text" tabindex="20" />
<label for="e_wageperhour">How Much Per Hour : </label> <input name="e_wageperhour" id="e_wageperhour" type="text" tabindex="21" />
<label for="e_hoursperweek">How Many Hours : </label> <input name="e_hoursperweek" id="e_hoursperweek" type="text" tabindex="22" />
<label for="e_status">F/T or P/T : </label> <input name="e_status" id="e_status" type="text" tabindex="23" />
</fieldset> <fieldset> <legend>Insurance Information</legend> <label for="insurance_company">Insurance Company : </label> <input name="insurance_company" id="insurance_company" type="text" tabindex="24" />
<label for="i_phone">Insurance Phone : </label> <input name="i_phone" id="i_phone" type="text" tabindex="25" />
<label for="i_policy">Policy Number : </label> <input name="i_policy" id="i_policy" type="text" tabindex="26" />
<label for="stock_num">Stock Number Interested : </label> <input name="stock_num" id="stock_num" type="text" tabindex="27" />
<label for="bank_approval">Bank Approval : </label> <input name="bank_approval" id="bank_approval" type="text" tabindex="28" /> </fieldset>
<p> <input id="button1" type="submit" name="submit" value="Send" /> <input id="button2" type="reset" /> </p> </form> </div> </div> <?php
} else if (isset($_POST['remove_x'])) { //show content according to this button echo "REMOVE BUTTON PRESSED"; } else if (isset($_POST['edit_x'])) { //show content according to this button echo "EDIT BUTTON PRESSED"; } else { echo "Please Select An Operation <b>" . $username . "</b>"; echo "<br />"; ?> <div align="center"> <form method="POST" action="index.php#3"> <input type="image" name="add" value="add" src="images/add.png" width="75" height="72" /> <input type="image" name="remove" src="images/remove.png" width="75" height="72" /> <input type="image" name="edit" src="images/edit.png" width="75" height="72" /> </form> </div> <?php } ?>
<div class="cleaner_h10"></div>
<p><a href="#2" class="cross-link" title="Go to Page 2">« Previous</a> | <a href="#4" class="cross-link" title="Go to Page 4">Next »</a></p>
</div> </div>
<div class="panel" title="Undecided"> <div class="wrapper">
<h2>UnderConstruction</h2>
<!--I'm going to keep this incase I want to add a LEft Front Image <div class="image_wrapper fl_image"> <img src="images/templatemo_image_05.jpg" alt="image"/> </div> --> <!-- And This in case of a Front Right Image <div class="image_wrapper fr_image"> <img src="images/templatemo_image_06.jpg" alt="image"/> </div> -->
<p><a href="#3" class="cross-link" title="Go to Page 3">« Previous</a> | <a href="#5" class="cross-link" title="Go to Page 5">Next »</a></p> </div> </div> <div class="panel" title="Submit Ticket"> <div class="wrapper">
<h2>Submit Ticket</h2>
<div id="contact_form">
<form method="post" name="contact" action="#"> <label for="author">Name:</label> <input type="text" id="author" name="author" class="required input_field" /> <div class="cleaner_h10"></div>
<label for="email">Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" /> <div class="cleaner_h10"></div>
<label for="url">URL:</label> <input type="text" name="url" id="url" class="input_field" /> <div class="cleaner_h10"></div>
<label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea> <div class="cleaner_h10"></div>
<input style="font-weight: bold;" type="submit" class="submit_btn" name="submitbutton" id="submitbutton" value=" Send " /> <input type="reset" name="reset" id="reset" value=" Reset " />
</form> </div>
<div class="address_info"> <h3>Mailing Address</h3> 111/222 Fusce quis diam sit amet tortor<br /> Vivamus vestibulum 10110, Mauris congue<br /><br /> <strong>Email:</strong> info [ at ] yourcompany [ dot ] com<br /> <strong>Website:</strong> www.templatemo.com
</div>
<div class="cleaner_h20"></div>
<p><a href="#4" class="cross-link" title="Go to Page 4">« Previous</a></p> </div> </div>
</div><!-- .panelContainer --> </div><!-- #slider1 --> </div><!-- .slider-wrap --> <p id="cross-links" style="width:0px; height: 0px; font-size:0; overflow: hidden;"> Same-page cross-link controls:<br /> <a href="#1" class="cross-link">Page 1</a> | <a href="#2" class="cross-link">Page 2</a> | <a href="#3" class="cross-link">Page 3</a> | <a href="#4" class="cross-link">Page 4</a> | <a href="#5" class="cross-link">Page 5</a> </p> <!-- end of slider -->
</div> <!-- end of templatemo_content --> </div> <!-- end of templatemo_content_wrapper --> <div id="templatemo_footer_wrapper"> <div id="templatemo_footer"> Copyright © 2012 <a href="#">Your Company Name</a> | Designed by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a> | Validate <a href="http://validator.w3.org/check?uri=referer">XHTML</a> & <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> </div> <div style="text-align: center; font-size: 0.75em;">Design Downloaded from <a href="http://www.template4all.com/">free CSS templates</a> | <a href="http://www.freethemes4all.com/">free website templates</a> | <a href="http://www.seodesign.us/" title="free wallpapers hd" target="_blank">Free Wallpapers HD</a>.</div> <!-- end of templatemo_footer --> </div> <!-- end of templatemo_footer_wrapper --> </body> </html> |