imimin Posted July 28, 2009 Share Posted July 28, 2009 I placed a new table inside a <td> in the code below (where the "*****NEW TABLE HERE VIA DB($adult_size_chart)*****" text is) and it works fine as long as I don't have it inside a heredoc. If I put it in a heredoc it does funky stuff to the rest of my table??? echo <<<HTML <input type='hidden' name='name' value='$prod_name' /> <input type='hidden' name='price' value='$price' /> <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 (Add $2.00) <BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> </TD> *****NEW TABLE HERE VIA DB($adult_size_chart)***** </tr> <tr> <td> <strong>Garment 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> </tr> HTML; Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/ Share on other sites More sharing options...
ignace Posted July 28, 2009 Share Posted July 28, 2009 What exactly do you put in the heredoc the php code block or only the ****** text? Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885131 Share on other sites More sharing options...
imimin Posted July 28, 2009 Author Share Posted July 28, 2009 "<table border=""1"" width=""100%"" cellpadding=""1"" cellspacing=""1""> <tr> <td align=""left""> Size/<BR> Approximate<BR>Age Range </td> <td align=""left""> Toddler<BR>2/3</td> <td align=""left""> Small<BR>4/5</td> <td align=""left""> Medium<BR>7/8</td> <td align=""left""> Large<BR>9/10</td> <td align=""left""> Extra Large<BR>12/14</td> </tr> <tr> <td align=""left""> Waist (inches)</td> <td align=""left"">18-22</td> <td align=""left"">20-24</td> <td align=""left"">22-26</td> <td align=""left"">24-28</td> <td align=""left"">26-28</td> </tr> <tr> <td align=""left""> Inseam (inches)</td> <td align=""left"">13</td> <td align=""left"">16</td> <td align=""left"">17</td> <td align=""left"">18</td> <td align=""left"">19</td> </tr> </table> " Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885158 Share on other sites More sharing options...
imimin Posted July 28, 2009 Author Share Posted July 28, 2009 If I put plain text in this <TD> it works fine. Is there a way to reformat to make the variable data to work? Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885259 Share on other sites More sharing options...
p2grace Posted July 29, 2009 Share Posted July 29, 2009 Hi imimin, it's good to see you're still making your way through some typical coding challenges If you look at the html surrounding your variable within your heredoc statement, you closed your <td> and then tried adding content after it (through the db variable). You need to put the closing </td> after the db variable. Try the following: echo <<<HTML <input type='hidden' name='name' value='$prod_name' /> <input type='hidden' name='price' value='$price' /> <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 (Add $2.00) <BR> <INPUT TYPE="RADIO" NAME=custom30 VALUE="Size Range: Child"> Child<BR> *****NEW TABLE HERE VIA DB($adult_size_chart)***** </td> </tr> <tr> <td> <strong>Garment 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> </tr> HTML; Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885455 Share on other sites More sharing options...
imimin Posted July 29, 2009 Author Share Posted July 29, 2009 Sorry! I just found an error in my DB data! The table I was pulling out was getting truncated somehow leaving out the end table tag! That would certainly cause the problem I was experiencing. Thank you for your time in this matter-I am sorry it bore no fruit ! Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885606 Share on other sites More sharing options...
p2grace Posted July 29, 2009 Share Posted July 29, 2009 Glad it was a simple fix Could you mark the topic as solved? Quote Link to comment https://forums.phpfreaks.com/topic/167830-strange-table-behavior-inside-a-heredoc/#findComment-885659 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.