php - Trouble writing a string value with spaces to a form -


i'm trying write php file pulls names of products database , creates button automatically searches out item name on ebay. i've been successful, i've found that, if product name has spaces, value written form concatenated @ space- i.e, passing string "red barchetta" appear "red" in search bar

the specific problem occurs on line down near end:

input type="text" name="_nkw" value='.$row['name'].'

...where $row['name'] might "cosmic catch", "_nkw" winds being "cosmic"

i'm sure rookie mistake, there's i'm missing. appreciated.

<?php $db_host = 'xxxxxxxxx'; // server name $db_user = 'xxxxx'; // username $db_pass = 'xxxxxx'; // password $db_name = 'xxxx'; // database name  $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$conn) {     die ('failed connect mysql: ' . mysqli_connect_error());   }  $sql = 'select *      products';  $query = mysqli_query($conn, $sql);  if (!$query) {     die ('sql error: '. mysqli_error($conn)); }   ?> <html> <head> <title>bmt products</title> <style type="text/css">     body {         font-size: 15px;         color: #343d44;         font-family: "segoe-ui", "open-sans", tahoma, arial;         padding: 0;         margin: 0;     }     table {         margin: auto;         font-family: "lucida sans unicode", "lucida grande", "segoe ui";         font-size: 12px;     }      h1 {         margin: 25px auto 0;         text-align: center;         text-transform: uppercase;         font-size: 17px;     }      table td {         transition: .5s;     }      /* table */     .data-table {         border-collapse: collapse;         font-size: 14px;         min-width: 537px;     }      .data-table th,      .data-table td {         border: 1px solid #e1edff;         padding: 7px 17px;     }     .data-table caption {         margin: 7px;     }      /* table header */     .data-table thead th {         background-color: #508abb;         color: #ffffff;         border-color: #6ea1cc !important;         text-transform: uppercase;     }      /* table body */     .data-table tbody td {         color: #353535;     }     .data-table tbody td:first-child,     .data-table tbody td:nth-child(4),     .data-table tbody td:last-child {         text-align: right;     }      .data-table tbody tr:nth-child(odd) td {         background-color: #f4fbff;     }     .data-table tbody tr:hover td {         background-color: #ffffa2;         border-color: #ffff0f;     }      /* table footer */     .data-table tfoot th {         background-color: #e5f5ff;         text-align: right;     }     .data-table tfoot th:first-child {         text-align: left;     }     .data-table tbody td:empty     {         background-color: #ffcccc;     }     </style> </head> <body> <h1>table 1</h1> <table class="data-table">     <caption class="title">bmt products database</caption>     <thead>         <tr>             <th>id</th>             <th>product</th>             <th>manufacturer</th>             <th>brand</th>             <th>year</th>             <th>video</th>             <th>image</th>             <th>popularity</th>             <th>ebay</th>         </tr>     </thead>     <tbody>     <?php     while ($row = mysqli_fetch_array($query))     {          $path = 'getimage.php?id='.$row['id'];         echo '<tr>                  <td>'.$row['id'].'</td>                              <td>'.$row['name'].'</td>                 <td>'.$row['manufacturer'].'</td>                 <td>'.$row['brand'].'</td>                 <td>'.$row['year'].'</td>                    <td>'.$row['video'].'</td>                 <td><img src='.$path.' alt="" border=3 height=100 width=100></img></td>                  <td>'.$row['popularity'].'</td>                 <td>                     <form method="get" action="http://www.ebay.com/sch/i.html" accept-charset="iso-8859-1" target="_blank" >                     <table style="margin:auto; font-family:arial; text-align:left; background:#ddd; border:1px solid #888; border-radius:.25em">                     <tbody><tr><td>                     <input type="hidden" name="_ssn" value="">                     <input type="hidden" name="_sop" value="12">                     <input type="text" name="_nkw" value='.$row['name'].'/>                     <input type="submit" value="search">                     </td></tr><tr><td>                     <input type="checkbox" name="lh_titledesc" value="1">                     <small>include description</small>                     </td></tr></tbody></table></form>                 </td>              </tr>';       }?>     </tbody>     <tfoot> </table> </body> </html> 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -