I have a variable that is submitted via an html form:
$_POST['ref']
And the variable retrieved from the table in the database:
$row['ref']
I have a basic script comparison to check if they are the same:
$ref = $_POST['ref']; $result = mysql_query("SELECT * FROM logbook.job"); if (!$result) { die("Query to show fields from table failed"); } $row = mysql_fetch_array($result); $refdb = $row['ref']; $refform = $_POST['ref']; echo $_POST['ref'] ."<br>". $row['ref'] . "<br><br>"; if ($refdb == $refform) { echo "Yes they are<br><br>"; } else { echo "No they are not<br><br>"; } if (is_string($_POST['ref'])) { echo "Yes"; } else { echo "No"; } echo "<br>"; if (is_string($row['ref'])) { echo "Yes"; } else { echo "No"; }
What outputs:
G2mtxW G2mtxW No they are not Yes Yes
I repeat them both. Than I ask if they match. Then I check if each row is.
Why aren't they the same? How can I make them fit
Any help would be appreciated
source share