Jump to content

Bl4ckMaj1k

Members
  • Posts

    93
  • Joined

  • Last visited

    Never

Everything posted by Bl4ckMaj1k

  1. Awesome!!! Next time I will definitely keep an eye out for that! This topic has officially been SOLVED!! My code works flawlessly with your help...thanks again mate!! ;-)
  2. How do you guys notice those small things!!!! Thanks bro! That at least got me past the first hurdle. I will now attempt my full code to ensure everything is working properly before I mark this as 'Solved'. Thanks again though that has saved my day!!!
  3. In a nutshell here is what I am wishing to do. The user clicks on a link. The link has an ID# embedded in it. For this example, we will assume that the Link ID (lid) = 4-1-1 Now I have 2 tables: Table 1 Columns: ID | contact_fname | contact_lname 10 Bl4ck Maj1k Table 2 Columns: ID | contact_id | link_id 1 10 4-1-1 I need to display the contact's First and Last name if he is associated with the current link. The way I thought to track that was via table joins. I have attempted a code but it doesnt work. I basically want to make it so whenever Table 1 has a person with an ID equal to the Contact ID of table 2 AND whenever the Link ID in our URL (which I am capturing via a $_GET function and storing in a variable) is equal to the Link ID in our table with the associated contact in it, I want to then display the First Name and Last Name. Below is my failed attempt at this. Weird thing is, I have done this several times before. I don't see myself doing anything different but I must be because it simply doesn't work. Any help would be greatly appreciated... <?php $link_id = $_GET['lid']; $query = "SELECT table1.id, table1.contact_fname, table1.contact_lname, table2.contact_id, table2.link_id FROM table1, table2 WHERE table1.id = table2.contact_id AND table2.link_id = $link_id"; $sql = mysql_query($query); while($row = mysql_fetch_array($sql)) { $contact_fname = $row['contact_fname ']; $contact_lname = $row['contact_lname ']; echo '' . $contact_fname . ' ' . $contact_lname . '' ; } ?> Please let me know what I am doing wrong here! Thanks boys and girls :-) Bl4ck Maj1k
  4. You can do that yourself actually (bottom center). Mine is actually bottom left for some reason lol... (damn you Google Chrome Browser!!!!!) Not Solved, but CLOSED. Bl4ck Maj1k
  5. This issue blew my mind too hard the last couple days. I think it had something to do with the fact that I was running a javascript pop up function inside of a javascript popup window. For example: Page 1 has a link that goes to a popup called Page 2. Page 2 also has a link that goes to a popup called Page 3. Page 3 wouldnt display the variables in the URL correctly. In the end, I just separated those functions (Javascript popup window doesn't navigate to a page which has another javascript popup function. Instead the first window (Page 2) now controls all the functions) and all worked fine again. I wish I understood what the actual problem is but if I had to guess it had something to do with the two javascript functions conflicting which caused the variables in my PHP to output as NULL. Weird I know but its my only guess. The work around was easily coded though, no big deal. Thanks all!!! This can be marked as solved.
  6. Tried removing location = no but that didn't change the issue. I didn't think the structure of the deny_approval page would have anything to do with it's predecessor's link. The link address is being called in the page right before it. Deny approval uses the $_POST for its form and $_GET for the project ID. But the URL address is irrelevant if I can't get the previous page to go to the right address.
  7. So I have these session variables being stored on login. Each page stores these session variables in local PHP variables. For some reason, all pages display that variable in the URL except one page. I have done some 'echo' work just to ensure variables have values stored and that everything was being read appropriately, no issues there. The variables are apparent everywhere on the page besides the URL. Below you can find all the code I have to make this thing work....maybe someone can point me in the right direction because I am STUMPED!!! LOL So my first page calls a popup window in javascript defined below. The link involves the following PHP $customer_id = $_SESSION['cid']; $customer_email = $_SESSION['cust_email']; $customer_fname = $_SESSION['cust_first_name']; $customer_contact_id = $_SESSION['customer_contact_id']; $customer_company_id = $_SESSION['customer_company_id']; $c_project_id = $_GET['pid']; $c_project_id = mysql_real_escape_string($c_project_id ); $c_project_id = eregi_replace("`", "", $c_project_id); Then comes in the Javascript... <script type="text/javascript"> <!-- $(document).ready(function(){ $(".approval").click(function(){ v = $(this).attr("id"); url = 'deny_approval.php?cid=<?php echo "$customer_id"; ?>&company_id=<?php echo "$customer_company_id"; ?>&customer_contact_id=<?php echo "$customer_contact_id"; ?>&pid=<?php echo "$customer_project_id"; ?>&section=' + v; window.open(url, "myWindow", "status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" ); }); }); //--> </script> And finally, the HTML.... <body> <a href="#" id="deny_quote_approval" class="approval">Deny Quote Approval</a><br /><br /> </body> Any ideas?? As always, any help would be greatly appreciated. Bl4ck Maj1k
  8. Pure genius!!! I totally understand this now. The syntax was throwing me off for a bit but I get it. The reason the input button didn't need the 'onclick' attribute added to it was because you stated in the javascript that any element with the class 'approval' would activate the function if 'click'...wow this is amazing!!! Thanks again man. Javascript has always been something that I've wanted to learn. Now that I am becoming rather fluent in PHP and finally realizing its limitations, I realize even more the importance to grasp a full understanding of both of these languages. Once again, I can't thank you enough. Bl4ck Maj1k
  9. This is amazing thanks. I will test it now. Meanwhile, do you mind explaining this to me? I don't mean to be a bother but I am extremely interested in understanding this.
  10. Thanks!!!! I am sure the JS gurus here will be able to assist.
  11. I know VERY LITTLE about javascript and am having trouble now with capturing the ID of the button that was pressed. With the form that I am attempting to create, what is wrong with the below javascript? <script type="text/javascript"> <!-- var section = document.getElementByName("deny_profile_approval").value; function deny_approval() { window.open( "deny_approval.php?section=+section", "myWindow", "status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> The form has been edited to the following: <form action="" method="post" enctype="multipart/form-data"> <input name="deny_profile_approval" type="button" onclick="deny_approval()" value="Deny Contact Info1" /><br /><br /> <input name="deny_profile_approval" type="button" onclick="deny_approval()" value="Deny Contact Info2" /><br /><br /> <input name="deny_profile_approval" type="button" onclick="deny_approval()" value="Deny Contact Info3" /><br /><br /> <input name="deny_profile_approval" type="button" onclick="deny_approval()" value="Deny Contact Info4" /><br /><br /> </form>
  12. Tried that and unfortunately still didn't work. I will give that a shot now. I figured that the variable remained null for that reason.
  13. This is most likely a simple issue. I thought it would be a piece of cake for me but boy was I wrong. What I want to do is capture which button on my form was pressed. With that information I wish to send the form to a javascript popup function (using the onclick command). The new page that pops up will have the following type of link: new_page.php?page_id=[whatever button was clicked] I can't seem to get this to work. The popup works fine but my button name won't show up in the link. Below I have added the code I am using. Let me know what may be the issue here. Any help will be greatly appreciated. <!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>Untitled Document</title> <script src="js/jquery-1.5.js" type="text/javascript"></script> <script type="text/javascript"> <!-- function deny_approval() { window.open( "deny_approval.php?section=<?php echo $_POST['deny_profile_approval']; ?>", "myWindow", "status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> </head> <body> <form action="" method="post" enctype="multipart/form-data"> <input name="deny_profile_approval1" type="button" onclick="deny_approval()" value="Deny Contact Info1" /><br /><br /> <input name="deny_profile_approval2" type="button" onclick="deny_approval()" value="Deny Contact Info2" /><br /><br /> <input name="deny_profile_approval3" type="button" onclick="deny_approval()" value="Deny Contact Info3" /><br /><br /> <input name="deny_profile_approval4" type="button" onclick="deny_approval()" value="Deny Contact Info4" /><br /><br /> </form> I don't know what I am doing wrong. I would think the $_POST should read the value I have for the input?? I started as a complete novice but now I think I am a bit more advanced than I used to be. Even still, small issues like this never cease to puzzle me. I look forward to your feedback.
  14. Hello All!!! How would one go about figuring out the cost of a system? For example....if I am making a project management system which can have, lets say, 100,000 staff and 500,000 customers. What type of system would I need to run this thing smoothly? What are costs per user? How do you calculate the needed bandwidth per each individual user. As of now, my queries are running very fast, very smooth...but I fear as the system gets popular and more and more users begin to take advantage, things will eventually slow down. I want to work in my costs now so I know what I need per user. I don't know if this is something people normally ask, but I am lost when it comes to figuring this out. Any help would be greatly appreciated. Thanks!! Bl4ck Maj1k
  15. Somewhat valid. It will have project ID along with the customer related to that project. Row 1 may have customer 11 associated with project 3-005-023 and then row 4 may have same project ID with a different customer ID associated with it. Seems to work fine for the time being. Whenever I need to call to it I just say something like show me all customers in project table where customer id = customer id from the customers table and project ID = current project we are viewing....would that work in a php statement?
  16. Thanks that helps....I think I understand. Also you are right about the many to many relationship type. Would it matter if I made a table called projects? My project ID is a unique ID being identified via PHP by me. So I could have a project in the projects table that reappears 100 times but all the customer IDs would be different. This way, I won't have to create a third table. Your thoughts? Bl4ck Maj1k
  17. Here is the 'want' right now: I have a database with a table for customers and another one for projects. I want the user to have the ability to select which customer they want to be associated with their project. I understand how to do this logically (set up of the tables relationships) but I cant seem to figure out how to do this via checkbox arrays. For example, there should be a list of checkboxes with the values being pulled from the customer database. Whichever customers are selected, their IDs should get placed into a row in the project table called cust id. So the project table would read like the following: ID: 1 Project ID: 3-002-055 Customer ID: Whatever the ID number is in the customers table (I have customer IDs being pulled from the URL) ID: 2 Project ID: 3-002-055 (same as above) Customer ID: Whatever the ID number is So in this case, both customers are working on the same project. With that being said, I know for a fact that this is possible via some kind of checkbox statement. Something that pretty much says the following (I already started my lame attempt at coding this....I am no expert to bare with me!): <?php $staff_id = $_SESSION['sid']; $company_id = $_GET['cid']; $company_id = mysql_real_escape_string($company_id ); $company_id = eregi_replace("`", "", $company_id); $sql = mysql_query("SELECT contact_fname, contact_lname FROM contact_info WHERE company_id='$company_id'"); while($row = mysql_fetch_array($sql)){ $contact_fname = $row["contact_fname"]; $contact_lname = $row["contact_lname"]; $select_contacts .= " <input name=\"contacts[]\" type=\"checkbox\" value=\"' . $contact_fname . ' ' . $contact_lname . '\" /><br /><br /> <input name=\"submit_contacts\" type=\"submit\"> "; } ?> This is where I am lost at. How do I say that whenever anything is checked, grab the value and store it into the database but in a separate record??? Bl4ck Maj1k
  18. LOL no idea what I was talking about but somehow answered my question exactly!!!!! Thanks. This is amazing, I truly appreciate you taking the time to show this to me. Bl4ck Maj1k
  19. Wow thanks for all that code!! I will play around with this first thing tomorrow. I am guessing that the only static information in this file is the portion that reads __FILE__ and __LINE__..... I am afraid I have never seen the two. Are those actual functions? You don't have to answer these questions. I can always Google them. Also, would this have to be run for every particular function that I am attempting? In which case I would be doing everything one by one?
  20. Wow I feel like a COMPLETE moron!!!!! Thanks MJDamato and everyone else for the debugging assistance. After running MJs code I was able to see EXACTLY what my issue was. It actually displayed the issue to me on screen....almost like my code was communicating to me....AWESOME!!! If you look at the way I spelled 'contact_lname' in the query, you will see that I am missing the letter 'n'....I just have 'contact_lame' LOL. I am sorry for wasting you guys' time. Now I can see the EXTREME importance of debugging. Can someone teach me the gist of it so I can start applying it to all my code?? I have finally gotten comfortable coding from scratch (blank documents feel so much better after you have filled them with code....and I am not talking copy and paste work!!) and now I realize that I have passed up a major step. Any help with this would be perfect!!!! Thanks for the help guys!!! I sincerely appreciate it!!! Bl4ck Maj1k
  21. EDIT: Just echoed ALL variables successfully. It is in fact pulling the submitted user data from the form. Its just not transferring that data over to the database. Totally understand and agree....I was going to come back to the error reporting and conditional statement to ensure everything was working ok. As of now, I just assume everything is working correctly if I get to the bottom of my if statement....which I do. Still, none the less, I went ahead and added your error function right below my session variable. There were no errors or issues whatsoever. Even though thats the case, I STILL don't write any data to my table. I built a small test PHP script just to make sure my table wasn't the issue. I had it write to the billing_info table and it wrote to it successfully....still completely lost.
  22. By default, the code calls itself in the case of a null action. None the less, I gave it a shot, still nothing.... :'( Whats really grinding my gears here is the fact that I have two IDENTICAL codes, all written in the same fashion. When I test those, they write to their respective tables just fine. When I write to this other table, I am getting an error....like....come onnnnn!!! lol, how is that even possible?? Below I have provided more structural detail so you can see how things work in this project. User clicks a button which creates a project ID. Project ID gets submitted to three tables General Info Table Company Info Table Billing Table From there of course each one of these tables have their own IDs with auto increment set. Next I do the actual update of the information. I fill out a form called edit_general_info.php?sid=1&cid=3&pid=3-003-0042 (<-- exmaple link) and upon submission it updates the General Info table WHERE project id = the project id from the link...in this case 3-003-0042. I know its capturing the project ID correctly. The same process is working for Company Info Table. Why would this error out on the Billing Table?? PHP can be your bestest most bestest buddy one day then a complete A-HOLE the next.....im gonna rip my EYES out guys lol.
  23. LOL.....glad I could leave an impact!!!! "THEY SHOULDA' NEVA' GAVE YOU N****Z MONEY!!!!" .....classic
  24. <?php session_start(); $successMsg = ''; $staff_id = $_SESSION['sid']; include_once "scripts/connect_to_mysql.php"; $customer_id = $_GET['cid']; $customer_id = mysql_real_escape_string($customer_id ); $customer_id = eregi_replace("`", "", $customer_id); $cust_project_id = $_GET['pid']; $cust_project_id = mysql_real_escape_string($cust_project_id ); $cust_project_id = eregi_replace("`", "", $cust_project_id); if (isset($_POST['billing_contact_fax_form_field_box'])){ $billing_contact_fname_form_field_box = $_POST['billing_contact_fname_form_field_box']; $billing_contact_lname_form_field_box = $_POST['billing_contact_lname_form_field_box']; $billing_contact_address_form_field_box = $_POST['billing_contact_address_form_field_box']; $billing_contact_city_form_field_box = $_POST['billing_contact_city_form_field_box']; $billing_contact_state_form_field_box = $_POST['billing_contact_state_form_field_box']; $billing_contact_zip_form_field_box = $_POST['billing_contact_zip_form_field_box']; $billing_contact_email_form_field_box = $_POST['billing_contact_email_form_field_box']; $billing_contact_phone_form_field_box = $_POST['billing_contact_phone_form_field_box']; $billing_contact_fax_form_field_box = $_POST['billing_contact_fax_form_field_box']; $billing_contact_pref_meth_contact_form_field_box = $_POST['billing_contact_pref_meth_contact_form_field_box']; $billing_contact_cc_billed_form_field_box = $_POST['billing_contact_cc_billed_form_field_box']; $sql = mysql_query("UPDATE billing_info SET contact_fname='$billing_contact_fname_form_field_box',contact_lame='$billing_contact_lname_form_field_box',address='$billing_contact_address_form_field_box',city='$billing_contact_city_form_field_box',state='$billing_contact_state_form_field_box',zip='$billing_contact_zip_form_field_box',email='$billing_contact_email_form_field_box',phone='$billing_contact_phone_form_field_box',fax='$billing_contact_fax_form_field_box',pref_meth_contact='$billing_contact_pref_meth_contact_form_field_box',cc_billed='$billing_contact_cc_billed_form_field_box' WHERE proj_id='$cust_project_id'"); $successMsg = '<p style="font-family:Myriad Web Pro" style="font-size:10px" style="color:#666">You have successfully updated the company\'s General Information.<br /><br /> <a href="javascript:window.close();">Close</a></p>'; echo $successMsg; exit(); } ?> I have played around with this for SOOOOO long. I have 2 other scripts that are almost exact replicas of this script. Only difference is they are communicating with a different table...but its basically the EXACT same structure of code and functions. My tables consist of some int values, some varchar values, and the data submitted in these variables should get written to the table where the project ID is = to the id I'm working with. All of that seems to be working fine but whenever I enter the info into the form and submit, NOTHING gets written to my table....I'm completely STUMPED and P-O'd that I just wasted a complete 2 hours doing guess and check and cross comparing scripts. I can't find a thing!!!! Below is my html.....hopefully someone smarter than me can put 2 and 2 together because obviously I am an idiot!!!! Also its organized so well that you would think diagnosing the issue would be simple....not the case. I am totally and utterly stumped. I will even add my other code that works to show you what I mean. <!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>Untitled Document</title> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript"> <!-- Form Validation --> function validate_form ( ) { valid = true; if ( document.form.billing_contact_fname_form_field_box.value == "" ) { alert ( "Please fill out the First Name field." ); valid = false; } if ( document.form.billing_contact_lname_form_field_box.value == "" ) { alert ( "Please fill out the Last Name field." ); valid = false; } if ( document.form.billing_contact_address_form_field_box.value == "" ) { alert ( "Please fill out the Address field." ); valid = false; } if ( document.form.billing_contact_city_form_field_box.value == "" ) { alert ( "Please fill out the City field." ); valid = false; } if ( document.form.billing_contact_state_form_field_box.value == "" ) { alert ( "Please fill out the State field." ); valid = false; } if ( document.form.billing_contact_zip_form_field_box.value == "" ) { alert ( "Please fill out the Zip field." ); valid = false; } if ( document.form.billing_contact_email_form_field_box.value == "" ) { alert ( "Please fill out the Email field." ); valid = false; } if ( document.form.billing_contact_phone_form_field_box.value == "" ) { alert ( "Please fill out the Phone field." ); valid = false; } if ( document.form.billing_contact_fax_form_field_box.value == "" ) { alert ( "Please fill out the Fax field." ); valid = false; } return valid; } <!-- Form Validation --> </script> </head> <body> <div id="pg_container"> <!--PAGE CONTAINER--> <div id="pgbdy_container"> <div id="pgbdy"> <div id="bdy_header"></div> <div id="bdy_content_area"> <div id="bdy_content_general_info"> <div id="bdy_form_header"> <p> Please complete the Billing Information form below.<br /> <i>Fields marked with a</i> <b>*</b> <i>are required fields.</i> </p> </div> <form action="" method="post" enctype="multipart/form-data" id="form" name="form" onsubmit="return validate_form ( );"> <!--BILLING CONTACT FIRST NAME--> <div id="billing_contact_fname_form"> <div id="billing_contact_fname_form_text"> <p>*First Name:</p> </div> <div id="billing_contact_fname_form_field"> <input name="billing_contact_fname_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT FIRST NAME--> <!--BILLING CONTACT LAST NAME--> <div id="billing_contact_lname_form"> <div id="billing_contact_lname_form_text"> <p>*Last Name:</p> </div> <div id="billing_contact_lname_form_field"> <input name="billing_contact_lname_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT LAST NAME--> <!--BILLING CONTACT ADDRESS NAME--> <div id="billing_contact_address_form"> <div id="billing_contact_address_form_text"> <p>*Address:</p> </div> <div id="billing_contact_address_form_field"> <input name="billing_contact_address_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT ADDRESS NAME--> <!--BILLING CONTACT CITY NAME--> <div id="billing_contact_city_form"> <div id="billing_contact_city_form_text"> <p>*City:</p> </div> <div id="billing_contact_city_form_field"> <input name="billing_contact_city_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT CITY NAME--> <!--BILLING CONTACT STATE NAME--> <div id="billing_contact_state_form"> <div id="billing_contact_state_form_text"> <p>*State:</p> </div> <div id="billing_contact_state_form_field"> <input name="billing_contact_state_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT STATE NAME--> <!--BILLING CONTACT ZIP NAME--> <div id="billing_contact_zip_form"> <div id="billing_contact_zip_form_text"> <p>*Zip:</p> </div> <div id="billing_contact_zip_form_field"> <input name="billing_contact_zip_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT ZIP NAME--> <!--BILLING CONTACT EMAIL NAME--> <div id="billing_contact_email_form"> <div id="billing_contact_email_form_text"> <p>*Email:</p> </div> <div id="billing_contact_email_form_field"> <input name="billing_contact_email_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT EMAIL NAME--> <!--BILLING CONTACT PHONE NAME--> <div id="billing_contact_phone_form"> <div id="billing_contact_phone_form_text"> <p>*Phone:</p> </div> <div id="billing_contact_phone_form_field"> <input name="billing_contact_phone_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT PHONE NAME--> <!--BILLING CONTACT FAX NAME--> <div id="billing_contact_fax_form"> <div id="billing_contact_fax_form_text"> <p>Fax:</p> </div> <div id="billing_contact_fax_form_field"> <input name="billing_contact_fax_form_field_box" type="text" /> </div> </div> <!--BILLING CONTACT FAX NAME--> <!--BILLING CONTACT PREFERRED METHOD OF CONTACT NAME--> <div id="billing_contact_pref_meth_contact_form"> <div id="billing_contact_pref_meth_contact_form_text"> <p>*Preferred Method of Contact:</p> </div> <div id="billing_contact_pref_meth_contact_form_field"> <select name="billing_contact_pref_meth_contact_form_field_box"> <option value="Email">Email</option> <option value="Phone">Phone</option> <option value="Fax">Fax</option> <option value="">Physical Mail</option> </select> </div> </div> <!--BILLING CONTACT PREFERRED METHOD OF CONTACT NAME--> <!--BILLING CONTACT CREDIT CARD OR BILLED NAME--> <div id="billing_contact_cc_billed_form"> <div id="billing_contact_cc_billed_form_text"> <p>*Will the customer pay with Credit Card or will they be billed (Credit must be approved before ordering)?</p> </div> <div id="billing_contact_cc_billed_form_field"> <select name="billing_contact_cc_billed_form_field_box"> <option value="Credit Card">Credit Card</option> <option value="Billed">Billed</option> </select> </div> </div> <!--BILLING CONTACT CREDIT CARD OR BILLED NAME--> <!-- SUBMIT BUTTON --> <div id="submit_billing_info"> <input name="submit_billing_info" type="submit" /> </div> <!-- SUBMIT BUTTON --> </form> </div> </div> </div> </div> <!--PAGE CONTAINER--> </div> </body> </html> Now here is the code that works in its entirety....please note that the above is broken up just as it would be seen on the page. PHP at the top and then the HTML. It mimics the script I am about to paste below. Please help meeeeeeee!!!! <?php session_start(); $successMsg = ''; $staff_id = $_SESSION['sid']; include_once "scripts/connect_to_mysql.php"; $customer_id = $_GET['cid']; $customer_id = mysql_real_escape_string($customer_id ); $customer_id = eregi_replace("`", "", $customer_id); $cust_project_id = $_GET['pid']; $cust_project_id = mysql_real_escape_string($cust_project_id ); $cust_project_id = eregi_replace("`", "", $cust_project_id); if (isset($_POST['company_name'])){ $company_name = ereg_replace("[[^A-Z a-z0-9]]", "", $_POST['company_name']); // filter everything but numbers and letters $customer_fname = ereg_replace("[^A-Z a-z0-9]", "", $_POST['customer_fname']); // filter everything but spaces, numbers, and letters $customer_lname = ereg_replace("[^A-Z a-z0-9]", "", $_POST['customer_lname']); // filter everything but spaces, numbers, and letters $customer_address = ereg_replace("[^A-Z a-z0-9]", "", $_POST['customer_address']); // filter everything but spaces, numbers, and letters $customer_city = ereg_replace("[^A-Z a-z0-9]", "", $_POST['customer_city']); // filter everything but numbers and letters $customer_state = ereg_replace("[^A-Z a-z0-9]", "", $_POST['customer_state']); // filter everything but numbers and letters $customer_zip = ereg_replace("[^A-Za-z0-9]", "", $_POST['customer_zip']); // filter everything but numbers and letters $customer_email = stripslashes($_POST['customer_email']); $customer_email = strip_tags($customer_email); $customer_email = mysql_real_escape_string($customer_email); $customer_phone = ereg_replace("[^A-Za-z0-9]", "", $_POST['customer_phone']); // filter everything but spaces, numbers, and letters $customer_fax = ereg_replace("[^A-Za-z0-9]", "", $_POST['customer_fax']); // filter everything but spaces, numbers, and letters $cust_pre_meth_contact = $_POST['cust_pre_meth_contact']; // filter everything but spaces, numbers, and letters $date_of_entry = date("F j, Y, g:i a"); $sql = mysql_query("UPDATE company_info SET company_name='$company_name',contact_fname='$customer_fname',contact_lname='$customer_lname', address='$customer_address', city='$customer_city', state='$customer_state', zip='$customer_zip', email='$customer_email', phone='$customer_phone', fax='$customer_fax',pref_meth_contact='$cust_pre_meth_contact',entry_date='$date_of_entry' WHERE proj_id='$cust_project_id'"); $successMsg = '<p style="font-family:Myriad Web Pro" style="font-size:13px" style="color:#666">You have successfully updated <b>' . $company_name . '\'s</a></b> Company Information.<br /><br /> <a href="javascript:window.close();">Close</a></p>'; echo $successMsg; exit(); } $sql = mysql_query("SELECT * FROM company_info WHERE proj_id='$cust_project_id' LIMIT 1"); while ($row = mysql_fetch_array($sql)) { $company_name = $row["company_name"]; $company_contact_fname = $row["contact_fname"]; $company_contact_lname = $row["contact_lname"]; $company_address = $row["address"]; $customer_city = $row["city"]; $customer_state = $row["state"]; $customer_zip = $row["zip"]; $customer_email = $row["email"]; $customer_phone = $row["phone"]; $customer_fax = $row["fax"]; $cust_pre_meth_contact = $row["pref_meth_contact"]; $cust_entry_date = $row["entry_date"]; } ?> <!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>Untitled Document</title> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript"> <!-- Form Validation --> function validate_form ( ) { valid = true; if ( document.form.company_name.value == "" ) { alert ( "Company Name field must not be blank." ); valid = false; } if ( document.form.customer_fname.value == "" ) { alert ( "Customer Address field must not be blank." ); valid = false; } if ( document.form.customer_lname.value == "" ) { alert ( "Customer Address field must not be blank." ); valid = false; } if ( document.form.customer_address.value == "" ) { alert ( "Customer Address field must not be blank." ); valid = false; } if ( document.form.customer_city.value == "" ) { alert ( "Customer City field must not be blank." ); valid = false; } if ( document.form.customer_state.value == "" ) { alert ( "Customer State field must not be blank." ); valid = false; } if ( document.form.customer_zip.value == "" ) { alert ( "Customer Password field must not be blank." ); valid = false; } if ( document.form.customer_email.value == "" ) { alert ( "Customer Email field must not be blank." ); valid = false; } if ( document.form.customer_phone.value == "" ) { alert ( "Customer Phone field must not be blank." ); valid = false; } if ( document.form.customer_fax.value == "" ) { alert ( "Customer Fax field must not be blank." ); valid = false; } return valid; } <!-- Form Validation --> </script> </head> <body> <div id="pg_container"> <!--PAGE CONTAINER--> <div id="pgbdy_container"> <div id="pgbdy"> <div id="bdy_header"></div> <div id="bdy_content_area"> <div id="bdy_content"> <div id="bdy_form_header"> <p> Create a new customer by filling out the form below.<br /> <i>Fields marked with a</i> <b>*</b> <i>are required fields.</i> </p> </div> <form action="edit_company_info.php?sid=<?php echo "$staff_id"; ?>&cid=<?php echo "$customer_id"; ?>&pid=<?php echo "$cust_project_id"; ?>" method="post" id="form" name="form" enctype="multipart/form-data" onsubmit="return validate_form ( );"> <!-- COMPANY NAME --> <div id="company_name_form"> <div id="company_name_text"> <p> Company Name: </p> </div> <div id="company_name_field"> <input name="company_name" type="text" id="company_name" value="<?php echo "$company_name"; ?>" /> </div> </div> <!--COMPANY NAME--> <!-- CUSTOMER FIRST NAME --> <div id="customer_fname_form"> <div id="customer_fname_text"> <p> Contact First Name: </p> </div> <div id="customer_fname_field"> <input name="customer_fname" type="text" id="customer_fname" value="<?php echo "$company_contact_fname"; ?>" /> </div> </div> <!-- CUSTOMER FIRST NAME --> <!-- CUSTOMER LAST NAME --> <div id="customer_lname_form"> <div id="customer_lname_text"> <p> Contact Last Name: </p> </div> <div id="customer_lname_field"> <input name="customer_lname" type="text" id="customer_lname" value="<?php echo "$company_contact_lname"; ?>" /> </div> </div> <!-- CUSTOMER LAST NAME --> <!-- CUSTOMER ADDRESS --> <div id="customer_address_form"> <div id="customer_address_text"> <p> Address: </p> </div> <div id="customer_address_field"> <input name="customer_address" type="text" id="customer_address" value="<?php echo "$company_address"; ?>" /> </div> </div> <!--CUSTOMER ADDRESS--> <!-- CUSTOMER CITY --> <div id="customer_city_form"> <div id="customer_city_text"> <p> City: </p> </div> <div id="company_name_field"> <input name="customer_city" type="text" id="customer_city" value="<?php echo "$customer_city"; ?>" /> </div> </div> <!--CUSTOMER CITY--> <!-- CUSTOMER STATE --> <div id="customer_state_form"> <div id="customer_state_text"> <p> State: </p> </div> <div id="customer_state_field"> <input name="customer_state" type="text" id="customer_state" value="<?php echo "$customer_state"; ?>" /> </div> </div> <!--CUSTOMER STATE--> <!-- CUSTOMER ZIP --> <div id="customer_zip_form"> <div id="customer_zip_text"> <p> Zip: </p> </div> <div id="customer_zip_field"> <input name="customer_zip" type="text" id="customer_zip" value="<?php echo "$customer_zip"; ?>" /> </div> </div> <!--CUSTOMER ZIP--> <!-- CUSTOMER EMAIL --> <div id="customer_email_form"> <div id="customer_email_text"> <p> Email: </p> </div> <div id="customer_email_field"> <input name="customer_email" type="text" id="customer_email" value="<?php echo "$customer_email"; ?>" /> </div> </div> <!--CUSTOMER EMAIL--> <!-- CUSTOMER PHONE--> <div id="customer_phone_form"> <div id="customer_phone_text"> <p> Phone: </p> </div> <div id="customer_phone_field"> <input name="customer_phone" type="text" id="customer_phone" value="<?php echo "$customer_phone"; ?>" /> </div> </div> <!--CUSTOMER PHONE--> <!-- CUSTOMER FAX--> <div id="customer_fax_form"> <div id="customer_fax_text"> <p> Fax: </p> </div> <div id="customer_fax_field"> <input name="customer_fax" type="text" id="customer_fax" value="<?php echo "$customer_fax"; ?>" /> </div> </div> <!--CUSTOMER FAX--> <!-- CUSTOMER PREFERRED METHOD OF CONTACT --> <div id="cust_pre_meth_contact_form"> <div id="cust_pre_meth_contact_text"> <p> What is the customer's preferred method of contact?<br /> <select name="cust_pre_meth_contact"> <option value="Email">Email</option> <option value="Fax">Fax</option> <option value="Phone">Phone</option> <option value="Physical Mail">Physical Mail</option> </select> </p> </div> </div> <!--CUSTOMER PREFERRED METHOD OF CONTACT --> <!-- SUBMIT BUTTON --> <div id="submit_new_customer_form"> <div id="submit_new_customer_button"> <p> <input name="submit_new_customer_info" type="submit" id="submit_new_customer" value="Update Customer Company Info" /> </p> </div> </div> </form> <!--SUBMIT BUTTON--> </div> </div> </div> </div> <!--PAGE CONTAINER--> </div> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.