Newbie question - form values showing up
Posted: Tue Feb 19, 2008 1:24 pm
Dear All,
I have just ordered a new server. Because I have only 1 site with minimal php code and a simple database, I decided to install php5 instead of php4 and now I have mysql5 instead of mysql4.
This is the old server info:
http://orbitalnets.com/support/info.php
The new server info:
http://orbnv.tempdomainname.com/support/info.php
I noticed that my forms on the new server are now showing the PHP values of the input form fields.
http://orbnv.tempdomainname.com/index.php?page=contact
On the old server (http://www.odubercontractor.com/index.php?page=contact) this was not the case.
Was this a PHP4 setting to hide the value or something similar?
Or how should I rewrite the code so that it will not show?
Here is the form code:
<?php
if (isset ($_POST['submit'])) {
$name = $_POST['name'] ;
$company= $_POST['company'] ;
$telephone = $_POST['telephone'] ;
$email = $_POST['email'] ;
$message = $_POST['message'] ;
if (ereg("^[a-zA-Z]+[[:space:]]?[a-zA-Z]*[[:space:]]?[a-zA-Z]*$", $name) && ereg("^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$", $email)){
mail( "info@orbitalnets.com", "Orbitalnets Online Message", '<html> HTML HERE </html>', "From: $email\n"."MIME-Version: 1.0\n" ."Content-type: text/html; charset=iso-8859-1");
header( "Location: index.php?page=success" );
}
else {
if (!ereg("^[a-zA-Z]+[[:space:]]?[a-zA-Z]*[[:space:]]?[a-zA-Z]*$", $name))
$flg_name=1;
if (!ereg("^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$", $email))
$flg_email=1;
}
}
?>
And here a snippet of the form:
<label for="name">Name</label>
<input id="name" name="name" type="text" value="<?= $name ?>" size="20" <?php if(!isset($flg_name)) echo ''; else echo 'class="form_error"'; ?> /> <?php if(isset($flg_name)) echo '<div><span class="form_error_text">Please fill in a name</span></div>';?>
Please let me know,
Dwayne
I have just ordered a new server. Because I have only 1 site with minimal php code and a simple database, I decided to install php5 instead of php4 and now I have mysql5 instead of mysql4.
This is the old server info:
http://orbitalnets.com/support/info.php
The new server info:
http://orbnv.tempdomainname.com/support/info.php
I noticed that my forms on the new server are now showing the PHP values of the input form fields.
http://orbnv.tempdomainname.com/index.php?page=contact
On the old server (http://www.odubercontractor.com/index.php?page=contact) this was not the case.
Was this a PHP4 setting to hide the value or something similar?
Or how should I rewrite the code so that it will not show?
Here is the form code:
<?php
if (isset ($_POST['submit'])) {
$name = $_POST['name'] ;
$company= $_POST['company'] ;
$telephone = $_POST['telephone'] ;
$email = $_POST['email'] ;
$message = $_POST['message'] ;
if (ereg("^[a-zA-Z]+[[:space:]]?[a-zA-Z]*[[:space:]]?[a-zA-Z]*$", $name) && ereg("^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$", $email)){
mail( "info@orbitalnets.com", "Orbitalnets Online Message", '<html> HTML HERE </html>', "From: $email\n"."MIME-Version: 1.0\n" ."Content-type: text/html; charset=iso-8859-1");
header( "Location: index.php?page=success" );
}
else {
if (!ereg("^[a-zA-Z]+[[:space:]]?[a-zA-Z]*[[:space:]]?[a-zA-Z]*$", $name))
$flg_name=1;
if (!ereg("^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$", $email))
$flg_email=1;
}
}
?>
And here a snippet of the form:
<label for="name">Name</label>
<input id="name" name="name" type="text" value="<?= $name ?>" size="20" <?php if(!isset($flg_name)) echo ''; else echo 'class="form_error"'; ?> /> <?php if(isset($flg_name)) echo '<div><span class="form_error_text">Please fill in a name</span></div>';?>
Please let me know,
Dwayne