Note that there are some explanatory texts on larger screens.

plurals
  1. POpost not completely posted PHP
    primarykey
    data
    text
    <p>I have a select value 'post', when someone wants to change the status of the post from unsolved to solved they have to choose a post en than click 'change to solved'</p> <p>The problem is when I click on the button, it doesn't change because PHP takes not the whole title of the post. So when my post is called 'Photoshop crashes', it only sends 'Photoshop'. That's why it doesn't update in my database, the query can't find the right post, when the title of the post is only 1 word, my table gets updated.</p> <pre><code>&lt;?php if (isset($_POST['btnSolved'])) { // wanneer er op de knop geklikt is proberen we user te saven in de databank if (!empty($_POST['btnSolved'])) { $solved = $_POST['unsolved']; $conn = new mysqli("localhost","root","root","PhpProject"); if ($conn -&gt; connect_errno) { throw new Exception("No connection with database!"); } else { $sql = "UPDATE Posts SET status = 'Solved' WHERE post='".$solved."'"; } } $conn-&gt;query($sql); } ?&gt; </code></pre> <p>In my body:</p> <pre><code>&lt;h3&gt;Change status&lt;/h3&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;" method="post"&gt; &lt;?php if(mysqli_num_rows($showBugs) &gt; 0) { echo "&lt;select name= unsolved&gt;"; while ($row = mysqli_fetch_assoc($showBugs)) { echo "&lt;option value=" . $row['subject'] . "&gt;" . $row['subject'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; } ?&gt; &lt;br /&gt; &lt;input class="btn btn-info dropdown-toggle" type="submit" name="btnSolved" value="Change to solved" /&gt; &lt;/form&gt; </code></pre> <p>This is what I get when I do a print of the $sql</p> <pre><code>UPDATE Posts SET status = 'Solved' WHERE post='Photoshop' </code></pre> <p>Does someone know why PHP can post 1 word, but not the whole title? It might be something stupid, but I don't know how to fix this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload