piznac Posted July 24, 2007 Share Posted July 24, 2007 Confused is hardly the word,. lol. Im getting a var sent to one function. Which I need to use in another function within a class. This is doable right? The var can be seen in the first function under the name $num2,.. and then I try to use it again under the rows function,.. I will attempt to highlight this var in black....Thanks! Yeah that didnt seem to work,. so just look for "this var==" <?php //start class class Order{ //upload order data function function insert_data($p_name, $po, $add1, $add2, $city, $state, $zip, $ship_type, $date_need, $firm, $p_po, $art, $num, $add_inst, $comm, $c_name,//this var===$num2){ $in = "INSERT INTO `c_order` (`p_name`, `po`, `add1`, `add2`, `city`, `state`, `zip`, `ship_type`, `date_need`, `firm`, `p_po`, `art`, `num`, `add_inst`, `comm`, `c_name`) VALUES ('$p_name', '$po', '$add1', '$add2', '$city', '$state', '$zip', '$ship_type', '$date_need', '$firm', '$p_po', '$art', NULL, '$add_inst', '$comm', '$c_name')"; $in_query = mysql_query($in) or die ("Insert Data Error:". mysql_error()); $num = mysql_insert_id(); //put into session $_SESSION["num"] = $num; $num2 = $num2; } //register new customer function function reg_user($b_name, $c_name, $add1, $add2, $city, $state, $zip, $phone, $fax, $email, $pass, $pass2){ require_once('/var/www/html/include/conn/sew.php'); if($pass != $pass2){ echo "The two password entered do not match, please <a href=\"\">try again</a>"; }else{ $reg = "INSERT INTO `user` (`name`, `pass`, `stat`, `num`, `c_name`, `add1`, `add2`, `city`, `state`, `zip`, `phone`, `fax`, `email`) VALUES ('$b_name', '$pass', 'NA', 'NULL', '$c_name', '$add1', '$add2', '$city', '$state', '$zip', '$phone', '$fax', '$email')"; $order_reg = mysql_query($reg) or die ("Register query error:" . mysql_error()); $_SESSION['MM_Username'] = $b_name; header('Location: http://sewnice.biz/ordering.php'); } } //how many order rows function function rows($numb){ if(//this var===$this->num2 == 1){ echo "One or more of the required fields was not filled out. Please go <a href=\"http://sewnice.biz/ordering.php\"> <<back </a> to correct this."; }else{ echo "<form action=\"$_SERVER[php_SELF]\" method=\"POST\" name=\"or2\" id=\"or2\"><table border=\"0\" class=\"log\" cellspacing=\"0\" bgcolor=\"E5E5E5\" name=\"main\"> <tr> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Item #</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Item Description</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Quanity</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Size</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Emb Location</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"><span class=\"pricelist\"><font color=\"ffffff\"> Artwork</font></span></td> <td class=\"nav\" bgcolor=\"#830000\"></td> </tr>"; for($i=0; $i<$numb; $i++){ ?> Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 bump Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 Instead of using $num2.. use $this->num2. That way the variable "$this->num2" is accessible throughout your whole class. class example { public $num2; public function foo() { $this->num2 = '100'; } public function shownum2() { // $this->num2 is accessible from here too! echo $this->num2; } } Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Ok well Im not getting an error now ,.. but the if statement is not working,.. and the var $num2 is set to one cause I echo'd it. In the first function I assigned $this->num3 = $num2;,.. so it should be set to the same as the $num2 var correct? Which the $num2 var is set to 1.... <?php //start class class Order{ var $num3; //upload order data function function insert_data($p_name, $po, $add1, $add2, $city, $state, $zip, $ship_type, $date_need, $firm, $p_po, $art, $num, $add_inst, $comm, $c_name,$num2){ $in = "INSERT INTO `c_order` (`p_name`, `po`, `add1`, `add2`, `city`, `state`, `zip`, `ship_type`, `date_need`, `firm`, `p_po`, `art`, `num`, `add_inst`, `comm`, `c_name`) VALUES ('$p_name', '$po', '$add1', '$add2', '$city', '$state', '$zip', '$ship_type', '$date_need', '$firm', '$p_po', '$art', NULL, '$add_inst', '$comm', '$c_name')"; $in_query = mysql_query($in) or die ("Insert Data Error:". mysql_error()); $num = mysql_insert_id(); //put into session $_SESSION["num"] = $num; echo $num2; $this->num3 = $num2; } //register new customer function function reg_user($b_name, $c_name, $add1, $add2, $city, $state, $zip, $phone, $fax, $email, $pass, $pass2){ require_once('/var/www/html/include/conn/sew.php'); if($pass != $pass2){ echo "The two password entered do not match, please <a href=\"\">try again</a>"; }else{ $reg = "INSERT INTO `user` (`name`, `pass`, `stat`, `num`, `c_name`, `add1`, `add2`, `city`, `state`, `zip`, `phone`, `fax`, `email`) VALUES ('$b_name', '$pass', 'NA', 'NULL', '$c_name', '$add1', '$add2', '$city', '$state', '$zip', '$phone', '$fax', '$email')"; $order_reg = mysql_query($reg) or die ("Register query error:" . mysql_error()); $_SESSION['MM_Username'] = $b_name; header('Location: http://sewnice.biz/ordering.php'); } } //how many order rows function function rows($numb){ $this = new Order(); if($this->num3 == "1"){ echo "One or more of the required fields was not filled out. Please go <a href=\"http://sewnice.biz/ordering.php?t=1\">back</a> to correct this."; }else{ echo "<form action=\"$_SERVER[php_SELF]\" method=\"POST\" name=\"or2\" id=\"or2\"><table border=\"0\" class=\"log\" cellspacing=\"0\" bgcolor=\"E5E5E5\" name=\"main\"> <tr> ?> I guess its simply not holding the value of what I assigned to it in the first function. Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 Try removing $this = new Order(); from the start of the function. Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Yeah just saw that myself,.. removed it and same. Can the var be assigned in one function and maintain that throughout other functions,.. or will it default back to var $num3? Like in your example,.. would echo $this->num2; return 100? Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 Assuming you ran the following from my example, it would return 100: $Example = new example; $Example->foo(); $Example->shownum2(); Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Ok but what if your trying to use the var in the next function,... class example { public $num2; public function foo() { $this->num2 = '100'; } public function shownum2() { // $this->num2 is accessible from here too! if($this->num2 == 100){ echo $this->num2; } } } Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 Do the same. remember that the var num2 is ONLY set to 100 for that INSTANCE of that object, not for all instances of that object. So to access the var num2 that is set to 100 you must use the same object that you used to set num2. So to execute your "example" class in your most recent post, you'd do exactly the same as what I put in my post - try it.. Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Yeah that worked,.. and sorry if Im a bit slow,.. but can you see why mine is not working. It seems to be the same. Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Wait so your saying I would have to call the orginal function again? Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 Could you paste the code you're using to use the class? Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 well I could but its very long,.. I think I see what your saying and I dont think thats gonna be possible for me,.. as Im calling one function in one place and the other in another place: <?php $go = $_SERVER['PHP_SELF']; if (!isset($_SESSION)) { session_start(); } if(isset($_SESSION['MM_Username'])){ $user = $_SESSION['MM_Username']; } if(isset($_POST['p_name'])){ $p_name = mysql_real_escape_string(trim(stripslashes($_POST['po']))); $po = mysql_real_escape_string(trim(stripslashes($_POST['p_name']))); $add1 = mysql_real_escape_string(trim(stripslashes($_POST['add1']))); $add2 = mysql_real_escape_string(trim(stripslashes($_POST['add2']))); $city = mysql_real_escape_string(trim(stripslashes($_POST['city']))); $state = mysql_real_escape_string(trim(stripslashes($_POST['state']))); $zip = mysql_real_escape_string(trim(stripslashes($_POST['zip']))); $ship_type = mysql_real_escape_string(trim(stripslashes($_POST['ship_type']))); $date_need = mysql_real_escape_string(trim(stripslashes($_POST['n_date']))); $c_name = mysql_real_escape_string(trim(stripslashes($_POST['c_name']))); //validate our order form +=+=+= if ($p_name == "" || $add1 == "" || $city == "" ||$state == "" || $zip == "" || $ship_type == "" || $date_need == ""){ $num2 = 1;}else{ $num2 = 0;} if (isset($_POST['firm'])){ $firm = mysql_real_escape_string(trim(stripslashes($_POST['firm']))); }else{ $firm = "N";} $p_po = mysql_real_escape_string(trim(stripslashes($_POST['p_po']))); $art = mysql_real_escape_string(trim(stripslashes($_POST['art']))); $num = ""; $add_inst = mysql_real_escape_string(trim(stripslashes($_POST['add_inst']))); $comm = mysql_real_escape_string(trim(stripslashes($_POST['comments']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $this->insert_data($p_name, $po, $add1, $add2, $city, $state, $zip, $ship_type, $date_need, $firm, $p_po, $art, $num, $add_inst, $comm, $c_name, $num2); if(isset($_FILES['file'])){ $filename = $_FILES['file']['name']; if(isset($_FILES['file2'])){ $filename2 = $_FILES['file2']['name'];}else{$fliename2 = "";} if(isset($_FILES['file3'])){ $filename3 = $_FILES['file3']['name'];}else{$fliename3 = "";} if(isset($_FILES['file4'])){ $filename4 = $_FILES['file4']['name'];}else{$fliename4 = "";} if(isset($_FILES['file5'])){ $filename5 = $_FILES['file5']['name'];}else{$fliename5 = "";} if(isset($_POST['c_name'])){ $c_name = $_POST['c_name'];} require_once("/var/www/html/include/classes/ordering.inc.php"); if(isset($_SESSION['num'])){ $or_num = $_SESSION['num']; } $this = new Order(); $this->upload_file($filename,$filename2,$filename3,$filename4,$filename5,$c_name,$or_num); } } if(isset($_POST['item_qty']) && !isset($_POST['kk'])){ $item_num = mysql_real_escape_string(trim(stripslashes($_POST['item_num']))); $item_desc = mysql_real_escape_string(trim(stripslashes($_POST['item_desc']))); $item_qty = mysql_real_escape_string(trim(stripslashes($_POST['item_qty']))); $emb_loc1 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc1']))); $num = mysql_real_escape_string(trim(stripslashes($_POST['num']))); $size = mysql_real_escape_string(trim(stripslashes($_POST['size']))); $artwork = mysql_real_escape_string(trim(stripslashes($_POST['artwork']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $this->insert_rows($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork); }elseif(isset($_POST['item_qty']) && isset($_POST['kk'])){ $item_num = mysql_real_escape_string(trim(stripslashes($_POST['item_num']))); $item_desc = mysql_real_escape_string(trim(stripslashes($_POST['item_desc']))); $item_qty = mysql_real_escape_string(trim(stripslashes($_POST['item_qty']))); $emb_loc1 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc1']))); $num = mysql_real_escape_string(trim(stripslashes($_POST['num']))); $size = mysql_real_escape_string(trim(stripslashes($_POST['size']))); $artwork1 = mysql_real_escape_string(trim(stripslashes($_POST['artwork1']))); $emb_loc2 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc2']))); $artwork2 = mysql_real_escape_string(trim(stripslashes($_POST['artwork2']))); $emb_loc3 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc3']))); $artwork3 = mysql_real_escape_string(trim(stripslashes($_POST['artwork3']))); $emb_loc4 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc4']))); $artwork4 = mysql_real_escape_string(trim(stripslashes($_POST['artwork4']))); $emb_loc5 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc5']))); $artwork5 = mysql_real_escape_string(trim(stripslashes($_POST['artwork5']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $this->insert_multi($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork1,$emb_loc2,$artwork2,$emb_loc3,$artwork3,$emb_loc4,$artwork4,$emb_loc5,$artwork5); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- InstanceBegin template="/Templates/nuemage_template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Nu Emage Embroidery</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="nuemagestyles.css" rel="stylesheet" type="text/css"> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <script type="text/javascript"> <!-- function myPopup2() { window.open( "http://www.sewnice.biz/s_po.php", "myWindow", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=190,height=112,left = 240,top = 212,status=1" ) } //--> </script> <script type="text/javascript"> <!-- function myPopup3() { window.open( "http://www.sewnice.biz/s_da.php", "myWindow2", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=190,height=200,left = 240,top = 212,status=1" ) } //--> </script> <script type="text/javascript"> <!-- function myPopup4() { window.open( "http://www.sewnice.biz/cust_logo2.php", "myWindow3", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 240,top = 212,status=1" ) } //--> </script> <SCRIPT LANGUAGE="JavaScript" SRC="CalendarControl.js"> </SCRIPT> <link href="CalendarControl[1].css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#CCCCCC"> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" > <tr> <td colspan="8"><img src="images/top_logo.jpg" alt="Nu Emage Embroidery" width="750" height="104"></td> </tr> </table> <table width="750" border="0" align="center" bgcolor="#830000"> <tr> <td width="49"> </td> <td width="65" class="nav"> <div align="center"><a href="index.php">HOME</a></div></td> <td width="112" class="nav"> <div align="center"><a href="digitizing.php">DIGITIZING</a></div></td> <td width="97" class="nav"> <div align="center"><a href="pricing.php">PRICING</a></div></td> <td width="114" class="nav"> <div align="center"><a href="ordering.php?t=1">ORDERING</a></div></td> <td width="204" class="nav"> <div align="center"><a href="production_schedule.php?n=<?php if(isset($_SESSION['MM_Username'])){echo $user;}?>">PRODUCTION SCHEDULE</a></div></td> <td width="86" class="nav"> <div align="center"><a href="contact.php">CONTACT</a></div></td> <td width="48"> </td> </tr> </table> <!-- InstanceBeginEditable name="maincontent" --> <table width="749" height="413" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <!--DWLayoutTable--> <tr> <td height="38" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="17" height="38" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="489" valign="top"><br> <?php if(isset($_SESSION['MM_Username'])){ $user = $_SESSION['MM_Username']; require_once("/var/www/html/include/classes/csv_upload.inc.php"); $this = new Csv(); $this->cust_bar($user); } ?></td> <td width="243" valign="top"><div align="center" class="orlist"> <div align="right"><a href="client.php">Log In</a> | Change Password </div> </div></td> </tr> </table></td> </tr> <tr> <td width="16" height="31" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="457" valign="top" class="titles">ORDERING</td> <td width="276" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="410" colspan="3" align="center" valign="top"><?php if(isset($_SESSION['num'])){$num = $_SESSION['num'];} //if is a multi location order start here if(isset($_POST['multi']) && $_POST['multi'] == "Y"){ $this = new Order(); $numb = $_POST['num']; $this->multi($numb); }else{ //if just one location start here if (!isset($_SESSION['MM_Username'])) { echo "<table align=\"center\" class=\"orlist\"><tr><td></br>You must be logged in to view the ordering system.Not a customer yet? Please <a href=\"reg.php\">register</a> to place an order</td></tr></table>"; }elseif(isset($_SESSION['MM_Username']) && !isset($num) && !isset($_POST['item_qty'])||isset($_SESSION['MM_Username']) && isset($_GET['t'])){ echo "</br> <form action=\"$go\" method=\"POST\" name=\"or\" id=\"or\" enctype=\"multipart/form-data\"> <table align=\"center\" class=\"log\" bgcolor=\"E5E5E5\" cellspacing=\"0\"> <tr> <td colspan=\"4\" bgcolor=\"830000\"> <b><font color=\"ffffff\">Step One</font></b></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Project Name:</span></td> <td><input type=\"text\" name=\"p_name\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> P.O.#:</span></td> <td><input type=\"text\" name=\"po\"></td> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Address:</span></td> <td class=\"nav\"><input type=\"text\" name=\"add1\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Address 2:</span></td> <td class=\"nav\"><input type=\"text\" name=\"add2\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship City:</span></td> <td class=\"nav\"><input type=\"text\" name=\"city\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship State:</span></td> <td class=\"nav\"><select size=\"1\" name=\"state\"> <option>Alabama</option> <option>Alaska</option> <option>Arizona</option> <option>Arkansas</option> <option>California</option> <option>Colorado</option> <option>Connecticut</option> <option>Delaware</option> <option>Florida</option> <option>Georgia</option> <option>Hawaii</option> <option>Idaho</option> <option>Illinois</option> <option>Indiana</option> <option>Iowa</option> <option>Kansas</option> <option>Kentucky</option> <option>Louisiana</option> <option>Maine</option> <option>Maryland</option> <option>Massachusetts</option> <option>Michigan</option> <option>Minnesota</option> <option>Mississippi</option> <option>Missouri</option> <option>Montana</option> <option>Nebraska</option> <option>Nevada</option> <option>New Hampshire</option> <option>New Jersey</option> <option>New Mexico</option> <option>New York</option> <option>North Carolina</option> <option>North Dakota</option> <option>Ohio</option> <option>Oklahoma</option> <option>Oregon</option> <option>Pennsylvania</option> <option>Rhode Island</option> <option>South Carolina</option> <option>South Dakota</option> <option>Tennessee</option> <option>Texas</option> <option>Utah</option> <option>Vermont</option> <option>Virginia</option> <option>Washington</option> <option>Washington, DC</option> <option>West Virginia</option> <option>Wisconsin</option> <option>Wyoming</option> </select><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Zip Code:</span></td> <td class=\"nav\"><input type=\"text\" name=\"zip\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Method Of Shipment:</span></td> <td class=\"nav\"><select size=\"1\" name=\"ship_type\"> <option>UPS Ground</option> <option>UPS Next Day Air Early AM</option> <option>UPS Next Day Air</option> <option>UPS Next Day Air Saver</option> <option>UPS 2nd Day Air Early AM</option> <option>UPS 2nd Day Air</option> <option>UPS 3 Day Select</option> <option>Customer Pick Up</option> <option>Courier</option> </select><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Date Needed:</span></td> <td class=\"nav\"><input type=\"text\" name=\"n_date\" onfocus=\"showCalendarControl(this);\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Firm For Event:</span></td> <td><input type=\"checkbox\" name=\"firm\" value=\"Y\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Previous P.O.#:</span></td> <td><input type=\"text\" name=\"p_po\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Artwork Filename:</span></td> <td><input type=\"text\" name=\"art\"></td> </tr> <tr valign=\"top\"> <td class=\"nav\"><span class=\"pricelist\" > Comments:</span></td> <td><textarea name=\"comments\"></textarea></td> </tr> <tr valign=\"top\"> <td class=\"nav\"><span class=\"pricelist\" > Additional Instructions:</span></td> <td><textarea name=\"add_inst\"></textarea></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Multiple Logo Locations:</span></td> <td><input type=\"checkbox\" name=\"multi\" value=\"Y\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\" > Estimated number of \"types\" of items:</span></td> <td><select size=\"1\" name=\"num\"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> <option>32</option> <option>33</option> <option>34</option> <option>35</option> <option>36</option> <option>37</option> <option>38</option> <option>39</option> <option>40</option> <option>41</option> <option>42</option> <option>43</option> <option>44</option> <option>45</option> <option>46</option> <option>47</option> <option>48</option> <option>49</option> <option>50</option> </select> </tr> <tr><td colspan=\"3\" bgcolor=\"830000\"><font color=\"ffffff\"> <b>Upload Logo</b></font></td></tr> <tr><td class=\"nav\" colspan=\"3\"><span class=\"pricelist\"> Upload Logo File:</span></td></tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file2\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file3\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file4\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file5\"></td></tr> <tr><td><input type=\"hidden\" name=\"c_name\" value=\"$_SESSION[MM_Username]\"> <tr> <td colspan=\"2\"><span class=\"pricelist\" ><font color=\"ff3300\"> * Required Fields</font></span></td></tr><tr> <td colspan=\"2\" align=\"center\"><INPUT type=\"submit\" value=\"Order 2nd Step>>\"></td> </tr> </table> </form> ";}elseif(!isset($_POST['item_qty']) && isset($num) && isset($_POST['num'])){ require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $numb = $_POST['num']; $this->rows($numb); }elseif(isset($_POST['num2']) && $_POST['num2'] >= 1){ require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $num = $_SESSION['num']; $this->display($num); $numb = $_POST['num2']; echo "</br>"; $this->rows($numb); }else{ echo "Your order has been submitted. Thank you, we will contact you if there are any problems. If you would like to place another order please <a href=\"ordering.php?t=1\">click here</a>"; require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $num = $_SESSION['num']; $this->email_data($num); $this->display_results($num); } } ?> <p> </p> <p> </p></td> </tr> </table> <!-- InstanceEndEditable --> <table width="750" border="0" align="center" cellpadding="4" cellspacing="0" class="footer"> <!--DWLayoutTable--> <tr> <td width="65"></td> <td width="60" valign="middle"><div align="right"><a href="home.php">HOME</a></div></td> <td width="5" valign="middle">|</td> <td width="80" valign="middle"><div align="center"><a href="digitizing.php">DIGITIZING</a></div></td> <td width="5" valign="middle">|</td> <td width="64" valign="middle"><div align="center"><a href="pricing.php">PRICING</a></div></td> <td width="5" valign="middle">|</td> <td width="80" valign="middle"><div align="center"><a href="ordering.php?t=1">ORDERING</a></div></td> <td width="5" valign="middle">|</td> <td width="148" valign="middle"><div align="center"><a href="production_schedule.php?n=<?php if(isset($_SESSION['MM_Username'])){echo $user;}?>">PRODUCTION SCHEDULE</a></div></td> <td width="5" valign="middle">|</td> <td width="77" valign="middle"><div align="left"><a href="contact.php">CONTACT</a></div></td> <td width="65"></td> </tr> <tr> <td class="copyright" height="20" colspan="13"><div align="center">2005 © Nu Emage Embroidery, Inc. All Rights Reserved</div></td> </tr> </table> </body> <!-- InstanceEnd --></html> Sorry if this is all junked up. Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 I think I just need to rethink this and do my validation in the first function. Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 24, 2007 Share Posted July 24, 2007 remove the second and third occurences of "$this = new Order();" in your script and it should work? Quote Link to comment Share on other sites More sharing options...
piznac Posted July 24, 2007 Author Share Posted July 24, 2007 Just the second and third? I tried that and removing all of them except the first one. Still the same (I was expecting undefined method or something,. but I didnt get that either) <?php $go = $_SERVER['PHP_SELF']; if (!isset($_SESSION)) { session_start(); } if(isset($_SESSION['MM_Username'])){ $user = $_SESSION['MM_Username']; } if(isset($_POST['p_name'])){ $p_name = mysql_real_escape_string(trim(stripslashes($_POST['po']))); $po = mysql_real_escape_string(trim(stripslashes($_POST['p_name']))); $add1 = mysql_real_escape_string(trim(stripslashes($_POST['add1']))); $add2 = mysql_real_escape_string(trim(stripslashes($_POST['add2']))); $city = mysql_real_escape_string(trim(stripslashes($_POST['city']))); $state = mysql_real_escape_string(trim(stripslashes($_POST['state']))); $zip = mysql_real_escape_string(trim(stripslashes($_POST['zip']))); $ship_type = mysql_real_escape_string(trim(stripslashes($_POST['ship_type']))); $date_need = mysql_real_escape_string(trim(stripslashes($_POST['n_date']))); $c_name = mysql_real_escape_string(trim(stripslashes($_POST['c_name']))); //validate our order form +=+=+= if ($p_name == "" || $add1 == "" || $city == "" ||$state == "" || $zip == "" || $ship_type == "" || $date_need == ""){ $num2 = 1;}else{ $num2 = 0;} if (isset($_POST['firm'])){ $firm = mysql_real_escape_string(trim(stripslashes($_POST['firm']))); }else{ $firm = "N";} $p_po = mysql_real_escape_string(trim(stripslashes($_POST['p_po']))); $art = mysql_real_escape_string(trim(stripslashes($_POST['art']))); $num = ""; $add_inst = mysql_real_escape_string(trim(stripslashes($_POST['add_inst']))); $comm = mysql_real_escape_string(trim(stripslashes($_POST['comments']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this = new Order(); $this->insert_data($p_name, $po, $add1, $add2, $city, $state, $zip, $ship_type, $date_need, $firm, $p_po, $art, $num, $add_inst, $comm, $c_name, $num2); if(isset($_FILES['file'])){ $filename = $_FILES['file']['name']; if(isset($_FILES['file2'])){ $filename2 = $_FILES['file2']['name'];}else{$fliename2 = "";} if(isset($_FILES['file3'])){ $filename3 = $_FILES['file3']['name'];}else{$fliename3 = "";} if(isset($_FILES['file4'])){ $filename4 = $_FILES['file4']['name'];}else{$fliename4 = "";} if(isset($_FILES['file5'])){ $filename5 = $_FILES['file5']['name'];}else{$fliename5 = "";} if(isset($_POST['c_name'])){ $c_name = $_POST['c_name'];} require_once("/var/www/html/include/classes/ordering.inc.php"); if(isset($_SESSION['num'])){ $or_num = $_SESSION['num']; } $this->upload_file($filename,$filename2,$filename3,$filename4,$filename5,$c_name,$or_num); } } if(isset($_POST['item_qty']) && !isset($_POST['kk'])){ $item_num = mysql_real_escape_string(trim(stripslashes($_POST['item_num']))); $item_desc = mysql_real_escape_string(trim(stripslashes($_POST['item_desc']))); $item_qty = mysql_real_escape_string(trim(stripslashes($_POST['item_qty']))); $emb_loc1 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc1']))); $num = mysql_real_escape_string(trim(stripslashes($_POST['num']))); $size = mysql_real_escape_string(trim(stripslashes($_POST['size']))); $artwork = mysql_real_escape_string(trim(stripslashes($_POST['artwork']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this->insert_rows($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork); }elseif(isset($_POST['item_qty']) && isset($_POST['kk'])){ $item_num = mysql_real_escape_string(trim(stripslashes($_POST['item_num']))); $item_desc = mysql_real_escape_string(trim(stripslashes($_POST['item_desc']))); $item_qty = mysql_real_escape_string(trim(stripslashes($_POST['item_qty']))); $emb_loc1 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc1']))); $num = mysql_real_escape_string(trim(stripslashes($_POST['num']))); $size = mysql_real_escape_string(trim(stripslashes($_POST['size']))); $artwork1 = mysql_real_escape_string(trim(stripslashes($_POST['artwork1']))); $emb_loc2 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc2']))); $artwork2 = mysql_real_escape_string(trim(stripslashes($_POST['artwork2']))); $emb_loc3 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc3']))); $artwork3 = mysql_real_escape_string(trim(stripslashes($_POST['artwork3']))); $emb_loc4 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc4']))); $artwork4 = mysql_real_escape_string(trim(stripslashes($_POST['artwork4']))); $emb_loc5 = mysql_real_escape_string(trim(stripslashes($_POST['emb_loc5']))); $artwork5 = mysql_real_escape_string(trim(stripslashes($_POST['artwork5']))); require_once("/var/www/html/include/classes/ordering.inc.php"); $this->insert_multi($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork1,$emb_loc2,$artwork2,$emb_loc3,$artwork3,$emb_loc4,$artwork4,$emb_loc5,$artwork5); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- InstanceBegin template="/Templates/nuemage_template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Nu Emage Embroidery</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="nuemagestyles.css" rel="stylesheet" type="text/css"> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <script type="text/javascript"> <!-- function myPopup2() { window.open( "http://www.sewnice.biz/s_po.php", "myWindow", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=190,height=112,left = 240,top = 212,status=1" ) } //--> </script> <script type="text/javascript"> <!-- function myPopup3() { window.open( "http://www.sewnice.biz/s_da.php", "myWindow2", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=190,height=200,left = 240,top = 212,status=1" ) } //--> </script> <script type="text/javascript"> <!-- function myPopup4() { window.open( "http://www.sewnice.biz/cust_logo2.php", "myWindow3", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 240,top = 212,status=1" ) } //--> </script> <SCRIPT LANGUAGE="JavaScript" SRC="CalendarControl.js"> </SCRIPT> <link href="CalendarControl[1].css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#CCCCCC"> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" > <tr> <td colspan="8"><img src="images/top_logo.jpg" alt="Nu Emage Embroidery" width="750" height="104"></td> </tr> </table> <table width="750" border="0" align="center" bgcolor="#830000"> <tr> <td width="49"> </td> <td width="65" class="nav"> <div align="center"><a href="index.php">HOME</a></div></td> <td width="112" class="nav"> <div align="center"><a href="digitizing.php">DIGITIZING</a></div></td> <td width="97" class="nav"> <div align="center"><a href="pricing.php">PRICING</a></div></td> <td width="114" class="nav"> <div align="center"><a href="ordering.php?t=1">ORDERING</a></div></td> <td width="204" class="nav"> <div align="center"><a href="production_schedule.php?n=<?php if(isset($_SESSION['MM_Username'])){echo $user;}?>">PRODUCTION SCHEDULE</a></div></td> <td width="86" class="nav"> <div align="center"><a href="contact.php">CONTACT</a></div></td> <td width="48"> </td> </tr> </table> <!-- InstanceBeginEditable name="maincontent" --> <table width="749" height="413" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <!--DWLayoutTable--> <tr> <td height="38" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="17" height="38" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="489" valign="top"><br> <?php if(isset($_SESSION['MM_Username'])){ $user = $_SESSION['MM_Username']; require_once("/var/www/html/include/classes/csv_upload.inc.php"); $this = new Csv(); $this->cust_bar($user); } ?></td> <td width="243" valign="top"><div align="center" class="orlist"> <div align="right"><a href="client.php">Log In</a> | Change Password </div> </div></td> </tr> </table></td> </tr> <tr> <td width="16" height="31" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="457" valign="top" class="titles">ORDERING</td> <td width="276" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="410" colspan="3" align="center" valign="top"><?php if(isset($_SESSION['num'])){$num = $_SESSION['num'];} //if is a multi location order start here if(isset($_POST['multi']) && $_POST['multi'] == "Y"){ $numb = $_POST['num']; $this->multi($numb); }else{ //if just one location start here if (!isset($_SESSION['MM_Username'])) { echo "<table align=\"center\" class=\"orlist\"><tr><td></br>You must be logged in to view the ordering system.Not a customer yet? Please <a href=\"reg.php\">register</a> to place an order</td></tr></table>"; }elseif(isset($_SESSION['MM_Username']) && !isset($num) && !isset($_POST['item_qty'])||isset($_SESSION['MM_Username']) && isset($_GET['t'])){ echo "</br> <form action=\"$go\" method=\"POST\" name=\"or\" id=\"or\" enctype=\"multipart/form-data\"> <table align=\"center\" class=\"log\" bgcolor=\"E5E5E5\" cellspacing=\"0\"> <tr> <td colspan=\"4\" bgcolor=\"830000\"> <b><font color=\"ffffff\">Step One</font></b></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Project Name:</span></td> <td><input type=\"text\" name=\"p_name\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> P.O.#:</span></td> <td><input type=\"text\" name=\"po\"></td> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Address:</span></td> <td class=\"nav\"><input type=\"text\" name=\"add1\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Address 2:</span></td> <td class=\"nav\"><input type=\"text\" name=\"add2\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship City:</span></td> <td class=\"nav\"><input type=\"text\" name=\"city\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship State:</span></td> <td class=\"nav\"><select size=\"1\" name=\"state\"> <option>Alabama</option> <option>Alaska</option> <option>Arizona</option> <option>Arkansas</option> <option>California</option> <option>Colorado</option> <option>Connecticut</option> <option>Delaware</option> <option>Florida</option> <option>Georgia</option> <option>Hawaii</option> <option>Idaho</option> <option>Illinois</option> <option>Indiana</option> <option>Iowa</option> <option>Kansas</option> <option>Kentucky</option> <option>Louisiana</option> <option>Maine</option> <option>Maryland</option> <option>Massachusetts</option> <option>Michigan</option> <option>Minnesota</option> <option>Mississippi</option> <option>Missouri</option> <option>Montana</option> <option>Nebraska</option> <option>Nevada</option> <option>New Hampshire</option> <option>New Jersey</option> <option>New Mexico</option> <option>New York</option> <option>North Carolina</option> <option>North Dakota</option> <option>Ohio</option> <option>Oklahoma</option> <option>Oregon</option> <option>Pennsylvania</option> <option>Rhode Island</option> <option>South Carolina</option> <option>South Dakota</option> <option>Tennessee</option> <option>Texas</option> <option>Utah</option> <option>Vermont</option> <option>Virginia</option> <option>Washington</option> <option>Washington, DC</option> <option>West Virginia</option> <option>Wisconsin</option> <option>Wyoming</option> </select><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Ship Zip Code:</span></td> <td class=\"nav\"><input type=\"text\" name=\"zip\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Method Of Shipment:</span></td> <td class=\"nav\"><select size=\"1\" name=\"ship_type\"> <option>UPS Ground</option> <option>UPS Next Day Air Early AM</option> <option>UPS Next Day Air</option> <option>UPS Next Day Air Saver</option> <option>UPS 2nd Day Air Early AM</option> <option>UPS 2nd Day Air</option> <option>UPS 3 Day Select</option> <option>Customer Pick Up</option> <option>Courier</option> </select><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Date Needed:</span></td> <td class=\"nav\"><input type=\"text\" name=\"n_date\" onfocus=\"showCalendarControl(this);\"><font color=\"ff3300\"> *</font></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Firm For Event:</span></td> <td><input type=\"checkbox\" name=\"firm\" value=\"Y\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Previous P.O.#:</span></td> <td><input type=\"text\" name=\"p_po\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Artwork Filename:</span></td> <td><input type=\"text\" name=\"art\"></td> </tr> <tr valign=\"top\"> <td class=\"nav\"><span class=\"pricelist\" > Comments:</span></td> <td><textarea name=\"comments\"></textarea></td> </tr> <tr valign=\"top\"> <td class=\"nav\"><span class=\"pricelist\" > Additional Instructions:</span></td> <td><textarea name=\"add_inst\"></textarea></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\"> Multiple Logo Locations:</span></td> <td><input type=\"checkbox\" name=\"multi\" value=\"Y\"></td> </tr> <tr> <td class=\"nav\"><span class=\"pricelist\" > Estimated number of \"types\" of items:</span></td> <td><select size=\"1\" name=\"num\"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> <option>32</option> <option>33</option> <option>34</option> <option>35</option> <option>36</option> <option>37</option> <option>38</option> <option>39</option> <option>40</option> <option>41</option> <option>42</option> <option>43</option> <option>44</option> <option>45</option> <option>46</option> <option>47</option> <option>48</option> <option>49</option> <option>50</option> </select> </tr> <tr><td colspan=\"3\" bgcolor=\"830000\"><font color=\"ffffff\"> <b>Upload Logo</b></font></td></tr> <tr><td class=\"nav\" colspan=\"3\"><span class=\"pricelist\"> Upload Logo File:</span></td></tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file2\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file3\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file4\"></td></tr> <tr> <tr><td colspan=\"2\"><input type=\"file\" name=\"file5\"></td></tr> <tr><td><input type=\"hidden\" name=\"c_name\" value=\"$_SESSION[MM_Username]\"> <tr> <td colspan=\"2\"><span class=\"pricelist\" ><font color=\"ff3300\"> * Required Fields</font></span></td></tr><tr> <td colspan=\"2\" align=\"center\"><INPUT type=\"submit\" value=\"Order 2nd Step>>\"></td> </tr> </table> </form> ";}elseif(!isset($_POST['item_qty']) && isset($num) && isset($_POST['num'])){ require_once("/var/www/html/include/classes/ordering.inc.php"); $numb = $_POST['num']; $this->rows($numb); }elseif(isset($_POST['num2']) && $_POST['num2'] >= 1){ require_once("/var/www/html/include/classes/ordering.inc.php"); $num = $_SESSION['num']; $this->display($num); $numb = $_POST['num2']; echo "</br>"; $this->rows($numb); }else{ echo "Your order has been submitted. Thank you, we will contact you if there are any problems. If you would like to place another order please <a href=\"ordering.php?t=1\">click here</a>"; require_once("/var/www/html/include/classes/ordering.inc.php"); $num = $_SESSION['num']; $this->email_data($num); $this->display_results($num); } } ?> <p> </p> <p> </p></td> </tr> </table> <!-- InstanceEndEditable --> <table width="750" border="0" align="center" cellpadding="4" cellspacing="0" class="footer"> <!--DWLayoutTable--> <tr> <td width="65"></td> <td width="60" valign="middle"><div align="right"><a href="home.php">HOME</a></div></td> <td width="5" valign="middle">|</td> <td width="80" valign="middle"><div align="center"><a href="digitizing.php">DIGITIZING</a></div></td> <td width="5" valign="middle">|</td> <td width="64" valign="middle"><div align="center"><a href="pricing.php">PRICING</a></div></td> <td width="5" valign="middle">|</td> <td width="80" valign="middle"><div align="center"><a href="ordering.php?t=1">ORDERING</a></div></td> <td width="5" valign="middle">|</td> <td width="148" valign="middle"><div align="center"><a href="production_schedule.php?n=<?php if(isset($_SESSION['MM_Username'])){echo $user;}?>">PRODUCTION SCHEDULE</a></div></td> <td width="5" valign="middle">|</td> <td width="77" valign="middle"><div align="left"><a href="contact.php">CONTACT</a></div></td> <td width="65"></td> </tr> <tr> <td class="copyright" height="20" colspan="13"><div align="center">2005 © Nu Emage Embroidery, Inc. All Rights Reserved</div></td> </tr> </table> </body> <!-- InstanceEnd --></html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.