I have this code:
PHP Code:
<?php
// function to output form and hold previously entered values.
function user_form() {
//output the form HTML.
echo '<p>Please fill in at least two fields.</p>';
echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF']).'" method="post">';
echo '<table border="0" cellspacing="4" cellpadding="0">';
echo '<tr><td>Vertical Distance:</td><td><input type="text" name="VD" value="'.htmlspecialchars($_POST['VD']).'"></td></tr>';
echo '<tr><td>Horizontal Distance:</td><td><input type="text" name="HD" value="'.htmlspecialchars($_POST['HD']).'"></td></tr>';
echo '<tr><td>Throw Distance:</td><td><input type="text" name="TD" value="'.htmlspecialchars($_POST['TD']).'"></td></tr>';
echo '<tr><td colspan="2"><input type="submit" value="submit" name="submit"></td></tr>';
echo '</table>';
echo '</form>';
}
// has the form been submitted?
if (isset($_POST['submit'])) {$error_str = '';
if( isset($_POST['VD'])) { if(!is_numeric($_POST['VD'])){$error_str .= '<li>VD must be a number</li>'; }
if( isset($_POST['HD']) ) { if( !is_numeric($_POST['HD'])){$error_str .= '<li>HD must be a number</li>'; }
if( isset($_POST['TD']) ) { if( !is_numeric($_POST['TD'])){$error_str .= '<li>TD must be a number</li>'; }
if (!empty($error_str)) {echo '<ul>'.$error_str.'</ul>'; user_form(); exit; }
else {echo'Success!!';}
} else {user_form(); }
?>
And I'm getting this errer:
Code:
Parse error: parse error, unexpected $ in /home/.sites/22/site13/web/livexchange/tools/pc2.php on line 32
There is no dollar sign on line 32!
Any ideas?