Jump to content

Strange table behavior inside a heredoc???


imimin

Recommended Posts

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;

Link to comment
Share on other sites

"<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>

"

 

Link to comment
Share on other sites

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;

 

 

Link to comment
Share on other sites

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  :-[ !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.