Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiple inputs - Problems with array
    primarykey
    data
    text
    <p>it is such that I need to use multiple inputs on my side,</p> <p>I've tried to do like this but it does not work as it will not show up on the page at all in some manner.</p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="onlinetestside"&gt; &lt;div id="onlinetestsidealt"&gt;&lt;?php echo $ordet;?&gt;&lt;/div&gt; &lt;input type="text" name="ord[]" maxlength="190"&gt; &lt;div style="clear:both;"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>PHP</strong></p> <pre><code>//ordetalt its coming from database. $alt = $_POST["ord"]; if($ordetalt == $alt) { echo $ordetalt . " og " . $alt; } else { echo "Error " . $ordetalt . " and " . $alt; } </code></pre> <p><strong>error appears like this:</strong></p> <p><em>Error Hej and Array</em></p> <p>What I want to get to it shall be such that <strong>"$ordetalt == $alt"</strong> have the same content and it fits together.</p> <p><strong>EIDT</strong></p> <p>Here I show the entire code where I need to download some code to the side.</p> <pre><code>if ($stmt = $this-&gt;mysqli-&gt;prepare('SELECT id, ordet, ordetalt FROM test WHERE getid = ?')) { $stmt-&gt;bind_param('i', $id); $id = $_GET['id']; $stmt-&gt;execute(); $stmt-&gt;bind_result($id, $ordet, $ordetalt); while ($stmt-&gt;fetch()) { ?&gt; &lt;div id="onlinetestside"&gt; &lt;div id="onlinetestsidealt"&gt;&lt;?php echo $ordet;?&gt;&lt;/div&gt; &lt;input type="text" name="ord[]" maxlength="190"&gt; &lt;div style="clear:both;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;?php //ordetalt its coming from database $alt = $_POST["ord"]; if($ordetalt == $alt) { echo $ordetalt . " og " . $alt; } else { echo "Error " . $ordetalt . " and " . $alt; } } $stmt-&gt;close(); </code></pre> <p>} </p> <p>EIDT EIDT</p> <pre><code>$i = 0; $a = $i++; $alt = $_POST["ord"][$a]; if($ordetalt == $alt) { echo $ordetalt . " og " . $alt; } else { echo "Error " . $ordetalt . " and " . $alt; } </code></pre>
    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