imimin Posted July 9, 2009 Author Share Posted July 9, 2009 <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); $get_items = "SELECT * FROM poj_products"; $get_items = mysql_query($get_items); $item_desc = $_GET['item_desc']; echo $item_row['desc'].'<br/><br/>'; ?> Getting error: Notice: Undefined variable: item_row in /homepages/27/d120150310/htdocs/poj/test2.php on line 46 Quote Link to comment Share on other sites More sharing options...
imimin Posted July 9, 2009 Author Share Posted July 9, 2009 If I use this code: <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); $cat = mysql_real_escape_string($_GET['cat']); $get_items = "SELECT * FROM poj_products"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); $item_desc = $_GET['item_desc']; echo $item_row['desc'].'<br/><br/>'; ?> I get the following error: Parse error: syntax error, unexpected $end in /homepages/27/d120150310/htdocs/poj/test2.php on line 70 Line 70 is the VERY BOTTOM OF THE PAGE! Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 9, 2009 Share Posted July 9, 2009 your missing a closing bracket } for the last if statement Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 9, 2009 Share Posted July 9, 2009 There are a few things to note, please see comments below. <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // you're requesting the $_GET['cat'], is it still present at this address? $cat = mysql_real_escape_string($_GET['cat']); // You are querying for all fields from the poj_products, not just those related to a $_GET[] variable. $get_items = "SELECT * FROM poj_products"; $get_items = mysql_query($get_items); if($get_items){ // You've queried for all possible results, in this case where there's potential for more than one result // you need to create a loop to save (or echo) all of the results while($item_row = mysql_fetch_assoc($get_items)){ //$item_desc = $_GET['item_desc']; you can delete this, as this I assume is being returned by the query, not by the $_GET[] var echo $item_row['desc'].'<br/><br/>'; } }else{ // you can always display the mysql errors as well to help troubleshoot echo mysql_error(); // always handle query exceptions die("Unable to connect to database."); } ?> If you could also post the exact url that is displayed when accessing this page that would help, because I'm assuming you only want to show query results related to a specific category (or some other field). Quote Link to comment Share on other sites More sharing options...
imimin Posted July 9, 2009 Author Share Posted July 9, 2009 '<a href="'.$sitelocation.$item_row['url'].'?item_adult_size_chart=$id. "&" . item_id=$id . "&" . item_cat=$id . "&" . item_child_size_chart=$id . "&" . item_weight=$id . "&" . item_selected_style=$id . "&" . item_retail=$id . "&" . item_prod_name=$id . "&" . item_img=$id"><IMG SRC=\"/images/order_now.jpg\" BORDER=\"0\"></A>'; How do you properly combine all of the variables that you want to pass the values of? I have tried everything I could think of and nothing seems to work! My syntax is obviously off. Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 9, 2009 Share Posted July 9, 2009 You have the right concept, but you're passing the same $id variable to each $_GET[] var. I'd recommend using heredoc syntax and extract() to keep it simple. Please see comments below. <?php extract($item_row); // this takes all keys of an array, and makes them their own variable. So $item_row['url'] can now be accessed by $url. // in your echo statement I've noticed that the value of each variable is the same $id, which will always have the same value. // we'll need to either specify new values for each variable, or if they really are the same, you only need to pass one variable. echo <<<HTML <a href="{$sitelocation}{$url}?item_adult_size_chart=$id&item_id=$id&item_cat=$id&item_child_size_chart=$id&item_weight=$id&item_selected_style=$id&item_retail=$id&item_prod_name=$id&item_img=$id"> <img src="/images/order_now.jpg" style="border: none;"> </a> HTML; // if all the variables really do use the same id, this can be rewritten using the following // then the logic can be updated in the script to use that id for each query. echo <<<HTML <a href="{$sitelocation}{$url}?id=$id"> <img src="/images/order_now.jpg" style="border: none;"> </a> HTML; ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 9, 2009 Author Share Posted July 9, 2009 All these variables correspond to fields in the same same row of the same table so I AM ASSUMING they are the same 'id'? Does that make sense? Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 9, 2009 Share Posted July 9, 2009 In that case you only need to pass the id once, and then query all fields of that row from that id. Is something like this what you're trying to achieve? <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // you're requesting the $_GET['cat'], is it still present at this address? $id = mysql_real_escape_string($_GET['id']); // You are querying for all fields from the poj_products, not just those related to a $_GET[] variable. $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ // I'm displaying the entire array just to make sure we're getting a result print_r($get_items);echo "<br />"; while($item_row = mysql_fetch_assoc($get_items)){ echo $item_row['desc'].'<br/><br/>'; } }else{ // you can always display the mysql errors as well to help troubleshoot echo mysql_error(); // always handle query exceptions die("Unable to connect to database."); } ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 9, 2009 Author Share Posted July 9, 2009 I am not sure what is going on? If I try your first code: echo <<<HTML <a href="{$sitelocation}{$url}?id=$id"> <img src="/images/order_now.jpg" style="border: none;"> </a> HTML; the link location that prints is: http://patternsofjoy.com/prod_detail.php?id=76 that does not look like variables to me ! If I use your second clip of code, I get the following error: Resource id #9 The second one also causes my echo statements on the next page to be printed twice with the error to be printed only after the first set of echos! Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 9, 2009 Share Posted July 9, 2009 If I understand what you're trying to do correctly, you should only have to pass: http://patternsofjoy.com/prod_detail.php?id=76 Since all the fields you need are within the database in the same row, you can simply pass the id of that row and parse the fields. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 OK, I set up the page that receives the id=# (poj_order_form.php) from the previous page (prod_detail.php): <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); $get_items = "SELECT * FROM poj_products"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); </TD> </TR> <TR> <TD> <B>Size Range:</B><BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Adult +$2.00"> Adult <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> </TD> <TD> $item_adult_size_chart = $_GET['item_adult_size_chart']; echo $item_row['adult_size_chart'].'<br/><br/>'; </TD> </TR> <TR> <TD> <B>Garment Size:</B> <SELECT NAME=custom40 SIZE=5> <OPTION VALUE='Size: Small (S)'>Small (S)</OPTION> <OPTION VALUE='Size: Medium (M)'>Medium (M)</OPTION> <OPTION VALUE='Size: Large (L)'>Large (L)</OPTION> <OPTION VALUE='Size: Extra Large (L)'>Extra Large (L)</OPTION> <OPTION VALUE='Size: Toddler (T)'>Toddler (T)</OPTION> </SELECT><BR> <A HREF="javascript:newwindow2()" >Garment Measuring Tips</A><BR> </TD> <TD> $item_child_size_chart = $_GET['item_child_size_chart']; echo $item_row['child_size_chart'].'<br/><br/>'; </TD> </TR> <TR> <TD> Quantity: <INPUT TYPE=TEXT NAME=quantity VALUE="1" SIZE=2 MAXLENGTH=2> <BR><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Order Now"> </FORM> </TD> </TR> }else{ die("Unable to connect to database.".mysql_error()); } ?> </TABLE> When I access this page (by passing the id=#), I get the following error: Parse error: syntax error, unexpected '<' in /homepages/27/d120150310/htdocs/poj/poj_order_form.php on line 252 line 252 is just below the "extract($item_row);" line. Also, I am not sure how to set the script up to echo variables in another part of my page: <?php $item_selected_style = $_GET['item_selected_style']; $item_prod_name = $_GET['item_prod_name']; $item_retail = $_GET['item_retail']; $item_weight = $_GET['item_weight']; $item_img = $_GET['item_img']; echo " <INPUT TYPE=HIDDEN NAME=name VALUE='$item_prod_name'> <INPUT TYPE=HIDDEN NAME=price VALUE='$item_retail'> <INPUT TYPE=HIDDEN NAME=sh VALUE='$item_weight'> <INPUT TYPE=HIDDEN NAME=img VALUE='https://secure.impact-impressions.com/poj/includes/img_resize3.php?src=$sitelocation$item_img&width=100&height=100&qua=50'> <INPUT TYPE=HIDDEN NAME=img2 VALUE=''> <INPUT TYPE=HIDDEN NAME=return VALUE='http://www.patternsofjoy.com/order_more.php'> <INPUT TYPE='RADIO' NAME='custom20' VALUE='Style: $item_selected_style' CHECKED='CHECKED' style='display:none'> <B>Garment Style: </B>$item_selected_style <BR>" ?> here I need to echo the variables listed after "echo" which are still in the old format I was using. Thank you for your help! Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 You have html within your php code, that's why it's throwing the error. Let's start with the basics. Does this work? <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // Clean the id $id = mysql_real_escape_string($_GET['id']); // Query Database $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); echo $adult_size_chart.'<br />'; echo $child_size_chart.'<br />'; }else{ die("Unable to connect to database.".mysql_error()); } ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 Yes, that works fine. I need to be able to split up the 2 echo lines to 2 different TD's. I also have the other data 2 deal with I made mention of in the second portion of my last post. It is important that the variables stay in the same order as shown in the second large portion of code. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 Would it be helpful if I were to send you the code to the whole page? Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 This should work for the first part. Try to implement this part first and we'll go from there. <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // Clean the id $id = mysql_real_escape_string($_GET['id']); // Query Database $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); echo <<<HTML <form name="order_form" method="post"> <table> <tr> <td> <strong>Size Range:</strong><br /> <input type="radio" name="custom30" value="Size Range: Adult +$2.00" /> Adult <input type="radio" name="custom30" value="Size Range: Child" /> Child </td> <td> $adult_size_chart<br /> $child_size_chart </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> $item_child_size_chart<br /> $child_size_chart<br /> </td> </tr> <tr> <td> <strong>Quantity:</strong> <input type="text" name="quantity" value="1" size="2" maxlength="2" /> <br /><br /> <input type="submit" name="add" value="Order Now" /> </td> </tr> </table> </form> HTML; }else{ die("Unable to connect to database.".mysql_error()); } ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 I was able to use your previous code and tried putting it in a single TD and it looks fine. If I use this most recent code, is it going to cause TABLE problems (I notice it has a start and end TABLE tag)?? Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 You can edit the html contained with the heredoc statement to your needs... Just post the resulting code so we can address the next steps Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 OK, this is what I got: <B>Garment Style: </B>$item_selected_style <BR>" ?> <a href="http://www.patternsofjoy.com/order_more.php" TITLE="Click here to change Garement Style">***Change Garment Style***</a> </TD> </TR> <TR> <TD> <B>Size Range:</B><BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Adult +$2.00"> Adult <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> </TD> <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // Clean the id $id = mysql_real_escape_string($_GET['id']); // Query Database $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); echo <<<HTML <td> $adult_size_chart<br /> $child_size_chart </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> $item_child_size_chart<br /> $child_size_chart<br /> </td> </tr> HTML; }else{ die("Unable to connect to database.".mysql_error()); } ?> <TR> <TD> Quantity: <INPUT TYPE=TEXT NAME=quantity VALUE="1" SIZE=2 MAXLENGTH=2> <BR><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Order Now"> </FORM> </TD> </TR> </TABLE> </TH> </TR> </TABLE> </TD> </TD> <!--<TD VALIGN="top"> <?php include("includes/login_box.inc"); ?> </TD>--> </TR> </TABLE> </CENTER> <TABLE cellpadding="30"> <TR> <TD> <?php include("includes/bottom_info.php"); ?> </TD> </TR> </TABLE> <?php include ("includes/footer.inc"); ?> and I get the following error: Parse error: syntax error, unexpected $end in /homepages/27/d120150310/htdocs/poj/poj_order_form.php on line 341 Line 341 is the very end of the page! Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 Using heredoc, the closing html; needs to be all the way to the left with 0 characters behind the semicolon on the same line. The code below should do the trick. <B>Garment Style: </B>$item_selected_style <BR>" ?> <a href="http://www.patternsofjoy.com/order_more.php" TITLE="Click here to change Garement Style">***Change Garment Style***</a> </TD> </TR> <TR> <TD> <B>Size Range:</B><BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Adult +$2.00"> Adult <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> </TD> <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // Clean the id $id = mysql_real_escape_string($_GET['id']); // Query Database $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); echo <<<HTML <td> $adult_size_chart<br /> $child_size_chart </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> $item_child_size_chart<br /> $child_size_chart<br /> </td> </tr> HTML; }else{ die("Unable to connect to database.".mysql_error()); } ?> <TR> <TD> Quantity: <INPUT TYPE=TEXT NAME=quantity VALUE="1" SIZE=2 MAXLENGTH=2> <BR><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Order Now"> </FORM> </TD> </TR> </TABLE> </TH> </TR> </TABLE> </TD> </TD> <!--<TD VALIGN="top"> <?php include("includes/login_box.inc"); ?> </TD>--> </TR> </TABLE> </CENTER> <TABLE cellpadding="30"> <TR> <TD> <?php include("includes/bottom_info.php"); ?> </TD> </TR> </TABLE> <?php include ("includes/footer.inc"); ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 Yes it did! Thank you. I did have to make a slight change as shown below: <td> $item_adult_size_chart<br /> $adult_size_chart </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> $item_child_size_chart<br /> $child_size_chart<br /> </td> </tr> Do you have any thoughts on the other block of code? Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 Just noticed on poj_order_form.php I am getting the following errors: Notice: Undefined variable: item_adult_size_chart in /homepages/27/d120150310/htdocs/poj/poj_order_form.php on line 273 Notice: Undefined variable: item_child_size_chart in /homepages/27/d120150310/htdocs/poj/poj_order_form.php on line 291 Patterns of Joy Order Form Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 But is fixed by removing the "item_" portion of the links and just inserting one line of "$adult_size_chart" like so: <td> $adult_size_chart<br /> </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> $child_size_chart<br /> </td> </tr> Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 Try this for your second part: <?php // You don't actually need these variables as they were already created from the query and extracted earlier. // This is of course we're assuming they are within the same script /* $item_selected_style = $_GET['item_selected_style']; $item_prod_name = $_GET['item_prod_name']; $item_retail = $_GET['item_retail']; $item_weight = $_GET['item_weight']; $item_img = $_GET['item_img']; */ // You should be able to display the values as such echo <<<HTML <input type='hidden' name='name' value='$item_prod_name' /> <input type='hidden' name='price' value='$item_retail' /> <input type='hidden' name='sh' value='$item_weight' /> <input type='hidden' name='img' value='$https://secure.impact-impressions.com/poj/includes/img_resize3.php?src=$sitelocation$item_img&width=100&height=100&qua=50' /> <input type='hidden' name='img2' value='' /> <input type='hidden' name='return' value='http://www.patternsofjoy.com/order_more.php' /> <input type='RADIO' name='custom20' value='Style: $item_selected_style' checked='checked' style='display: none' /> <strong>Garment Style: </strong>$item_selected_style <br /> HTML; ?> Quote Link to comment Share on other sites More sharing options...
imimin Posted July 10, 2009 Author Share Posted July 10, 2009 OK, after modifying your script, I was able to get it to work pretty much how I need it to: <?php /* Enable displaying of errors */ error_reporting(E_ALL); ini_set('display_errors', 'On'); // Ensure id was set if(!isset($_GET['id'])){ die("Id isn't set"); } // Clean the id $id = mysql_real_escape_string($_GET['id']); // Query Database $get_items = "SELECT * FROM poj_products WHERE `id` = '$id'"; $get_items = mysql_query($get_items); if($get_items){ $item_row = mysql_fetch_assoc($get_items); extract($item_row); echo <<<HTML <IMG SRC=\includes/img_resize3.php?src=$sitelocation$img&width=175&height=175&qua=100\" BORDER=\"0\"> <BR> Sample image of selected <BR>garment</P> </TD> <TD width=25%> <B>Garment Color:</B> <SCRIPT LANGUAGE="javascript"> GarmentColorArray = new Array (9); GarmentColorArray[1] = "RedHib2.jpg"; GarmentColorArray[2] = "DarkBlueHib2.jpg"; GarmentColorArray[3] = "TurquoiseHib3.jpg"; GarmentColorArray[4] = "PurpleHib2.jpg"; GarmentColorArray[5] = "blue.jpg"; GarmentColorArray[6] = "white.jpg"; GarmentColorArray[7] = "pink.jpg"; GarmentColorArray[8] = "AmerFlag.jpg"; GarmentColorArray[9] = "100DollarBill.jpg"; function GarmentColorImageSwap(imgBase,imgIndex) { Index = imgIndex + 1; document.GarmentColorImage.src = '/images/swatches/' + GarmentColorArray[index]; } </SCRIPT> <script language="JavaScript"> function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array("custom10", "custom20", "custom30", "custom40"); // Enter field description to appear in the dialog box var fieldDescription = Array("Garment Color", "Garment Style", "Size Range", "Garment Size"); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } </script> <FORM METHOD=POST ACTION="https://secure.impact-impressions.com/cgi-bin/cart.pl" onsubmit="return formCheck(this);"> <SELECT NAME="custom10" SIZE=9 ONCHANGE="GarmentColorImageSwap('GarmentColorImage', this.selectedIndex)" SIZE="1"> <OPTION VALUE='Color: RED Hibiscus'>RED Hibiscus</OPTION> <OPTION VALUE='Color: Dark Blue Hibiscus'>Dark Blue Hibiscus</OPTION> <OPTION VALUE='Color: Turquoise Hibiscus'>Turquoise Hibiscus</OPTION> <OPTION VALUE='Color: Purple Hibiscus'>Purple Hibiscus</OPTION> <OPTION VALUE='Color: Blue'>Blue</OPTION> <OPTION VALUE='Color: White'>White</OPTION> <OPTION VALUE='Color: Pink'>Pink</OPTION> <OPTION VALUE='Color: American Flag'>American Flag</OPTION> <OPTION VALUE='Color: Hundred Dollar Bill'>Hundred Dollar Bill</OPTION> </SELECT> <BR> <A HREF="javascript:newwindow()" >View All Color Choices</A> </TD> <TD ROWSPAN=2 valign="top"><P align=center><IMG ALIGN='top' BORDER='0' HEIGHT='175' NAME='GarmentColorImage' SRC='/images/swatches/blank.jpg' WIDTH='175'> <BR> Image of Garment Color <BR>selected. NOTE: Colors <BR>may vary.</P> </TD> </TR> <TR> <TD> <input type='hidden' name='name' value='$prod_name' /> <input type='hidden' name='price' value='$retail' /> <input type='hidden' name='sh' value='$weight' /> <input type='hidden' name='img' value='https://secure.impact-impressions.com/poj/includes/img_resize3.php?src=$sitelocation$img&width=100&height=100&qua=50' /> <input type='hidden' name='img2' value='' /> <input type='hidden' name='return' value='http://www.patternsofjoy.com/order_more.php' /> <input type='RADIO' name='custom20' value='Style: $selected_style' checked='checked' style='display: none' /> <strong>Garment Style: </strong>$selected_style <br /> <a href="http://www.patternsofjoy.com/order_more.php" TITLE="Click here to change Garement Style">***Change Garment Style***</a> </TD> </TR> <TR> <TD> <B>Size Range:</B><BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Adult +$2.00"> Adult <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> </TD> <td> Adult and Teen Sizing Chart: $adult_size_chart<br /> </td> </tr> <tr> <td> <strong>Garmet Size:</strong> <select id="custom40" name="custom40" size='5'> <option value="Size: Small (S)">Small (S)</option> <option value="Size: Medium (M)">Medium (M)</option> <option value="Size: Large (L)">Large (L)</option> <option value="Size: Extra Large (L)">Extra Large (L)</option> <option value="Size: Toddler (T)">Toddler (T)</option> </select><br /> <a href="javascript:newwindow2();" >Garment Measuring Tips</a> </td> <td> Child Sizing Chart: $child_size_chart<br /> </td> </tr> HTML; }else{ die("Unable to connect to database.".mysql_error()); } ?> I have one other problem I can't figure out, I need for the line: <input type='hidden' name='price' value='$retail' /> to do something like: <input type='hidden' name='price' value='$retail*.75' /> but everything I do does not seem to work? Thank You! Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 10, 2009 Share Posted July 10, 2009 You need to do the math outside of the heredoc, and then call it: // put the following line above the heredoc $price = $retail * .75; echo <<<HTML ... <input type='hidden' name='price' value='$price' /> Make sense? 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.