Hey guys,

I have been moving and testing my scripts on a different web server, but I am not getting the same results on both computers.

Here is the code:

<?php session_start();

//THIS FUNCTION VALIDATES INPUT
function VerifyForm(&$values, &$errors) {

   if (strlen($values['firstname']) == 0) {
      $errors['firstname'] = 'Please Enter a name';
   }
   if (strlen($values['surname']) == 0) {
   	$errors['surname'] = 'Plese Enter a surname';
   }
   return (count($errors) == 0);
}
?>
<?php
    if (count($errors) > 0) {
		echo "Ooops! There were some errors in your form..."; 
    }
?>

<form name="registerform" action="#" method="POST">
	<table cellpadding="2px">
                 <tr>
			<td>First Name:</td>
			<td><input type="text" name="firstname" maxlength="40" <?= htmlentities($values['firstname']) ?></td>
			<td class="error"><?= $errors['firstname'] ?></td>
		</tr>
		<tr>
			<td>Surname:</td>
			<td><input type="text" name="surname" maxlength="40" value"<?= htmlentities($values['surname']) ?></td>
			<td class="error"><?= $errors['surname'] ?></td>
		</tr>
        </table>
</form>

I'm guessing it's to do with the tags... "Ooops! There were some errors in your form..." displays on the page, but none of the <?= $errors ?> are displayed. Is there a type of tag I can use to make the errors display? (Preferably without changing the settings of the web server)?

Thanks

Solved...

"The special output version, which looks like this:

<?= [output here] ?>

This is the same as writing:

<?php echo "some output"; ?>

If you ever change to another server, the short or special output version options may be disabled."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.