PHP没有提取数据

时间:2016-02-25 17:54:38

标签: javascript php jquery

我对此文件存在问题,因为它没有将数据提取到地址字段。此外,每当添加“注释”时,地址中的任何数据都会消失。有任何想法吗?

    <tbody>
' ;

    $message .='<tr class="' . ($counter++ % 2 ? "odd" : "even") . '" >

      <td width="30%">Name:</td>

      <td width="70%">' . $result['fname'] . '&nbsp;'.$result['lname'].'</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Email:</td>

      <td>' . $result['email'] . '</td>

    </tr>' ;

    if($result['business'] != "" &&  $result['business'] != "Business" ) {

    $message .= '<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td width="30%">Business Name:</td>

      <td width="70%">'.$result['business'].'</td>

    </tr>' ;

    }

    $message .='

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Phone:</td>

      <td>' . $result['phone'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Returning Customer:</td>

      <td>'.$result['hrcustomer']. '</td>

    </tr>';
    if ($result['hrcustomer'] == "No") {
        $message .= '
    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">
      <td>Source:</td>
      <td>' . $result['howhere'] . '</td>
    </tr>';
    }

    $message .= '
    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

        <td>Preferred Contact:</td>

        <td>'.$result['howcontacted'].'</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Color:</td>

      <td>' . $result['garment_color'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>White Base Ink?:</td>

      <td>' . $result['white_base'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Quantity:</td>

      <td>' . $result['quantity'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Type:</td>

      <td>' . $result['garment_type'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

     <td>Size:</td>

      <td>' . $result['garment_size'] . '</td>

    </tr>
    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">
     <td>Delivery:</td>
      <td>' . $result['prefer_contact'] . '</td>
    </tr>
    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">
      <td>' . ($result['prefer_contact'] == "Shipping" ? "Ship Date" : "Pickup Date") . ':</td>
      <td>' . date("m/d/Y",strtotime($result['oqship_date'])) . '</td>
    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Turnaround time:</td>

      <td>' . $result['trndtime'] . '</td>

    </tr>' ;

    if($result['prefer_contact'] == "Shipping" )

    {

        $message .= '

         <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

            <td colspan="2"><h3>Shipping Address: </h3> </td>

        </tr>

        <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Name:</td>

      <td>' . $result['s_name'] . '</td>

    </tr>' ;

    if($result['s_business'] != "" &&  $result['s_business'] != "Business" ) {

    $message .= '<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td >Business Name:</td>

      <td >' .$result['s_business'].'</td>

    </tr>' ;

    }

    $message .='<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Address1: </td>

      <td>' . $result['s_address1'] . '</td>

    </tr>' ;

    if($result['s_address2'] != "" &&  $result['s_address2'] != "Address 2" ) {

    $message .= '<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Address2:</td>

      <td>'.$result['s_address2'].'</td>

    </tr>' ;

    }

    $message .='<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>City:</td>

      <td>' . $result['s_city'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>State: </td>

      <td>' . $result['s_state'] . '</td>

    </tr>

    <tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

      <td>Zip Code: </td>

      <td>' . $result['s_zip'] . '</td>

    </tr>

        ' ;

    }

    $message .= '<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

       <td valign="top">Comment: </td>

      <td valign="top">' . html_entity_decode($result['message']) . '</td>

    </tr>' ;
    if($result['notes'] != "" ) {
    $message .= '<tr class="notes_written">

       <td valign="top">Notes: </td>

      <td valign="top">' .html_entity_decode($result['notes']). '</td>

    </tr>
    <tr>
    <td colspan="2">&nbsp;</td>
    </tr>' ;
    }
    $message .= '<tr>

      <td valign="top" colspan="2">
        <h2 style="margin-top:10px">Artwork And Files</h2>

我在想if($ result) 但不确定错误在哪里

1 个答案:

答案 0 :(得分:0)

检查输出源并查看是否显示任何地址字段。我可以看到您的HTML标记已损坏,请参阅以下代码,TR并且未正确关闭或打开

<td>' . $result['s_name'] . '</td>

</tr>' ;

if($result['s_business'] != "" &&  $result['s_business'] != "Business" ) {

$message .= '<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

  <td >Business Name:</td>

  <td >' .$result['s_business'].'</td>

</tr>' ;

}

$message .='<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">

  <td>Address1: </td>

  <td>' . $result['s_address1'] . '</td>

</tr>' ;