Hi
I must now seek help after too many hours of failure.
I'm using a basic form with Ajax (prettyPopin), but the form is not connecting to the database. I'm obviously overlooking something.
Here is the basic form:
retailer.html
<h3>Retailer Contact</h3>
<form name="ajaxForm" action="ajax/form_submit.php" method="post" class="genericForm">
<label><span>* Full name</span>
<input type="text" name="full_name" id="full_name" class="input-text"/>
</label>
<label><span>* Email</span>
<input type="text" name="email" id="email" class="input-text"/>
</label>
<input name='submit' type='submit' class='button' value='register' style='height:20px; color:#444; width:80px;'>
</form>
Here is the php page the form calls:
form_submit.php
<h3>Subscribe to our<br />newsletter</h3>
<?php
require( 'config.php' );
$con = mysql_connect( $mySQLhost,$mySQLuser,$mySQLpass ) or die( 'Error: ' . mysql_error() );
mysql_select_db( $mySQLdb );
$hasError = false;
$nameError = false;
$emailError = false;
if($_POST['full_name'] == ""){
$hasError = true;
$nameError = true;
}
if($_POST['email'] == ""){
$hasError = true;
$emailError = true;
}
if(!eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $_POST['email'])){
$hasError = true;
$emailError = true;
}
if($hasError){ ?>
<form name="ajaxForm" action="ajax/form_submit.php" class="genericForm">
<label for="name">Name</label>
<input type="text" name="name" id="name" value="<?php echo $_POST['full_name'] ?>" />
<?php if($nameError){ ?><div class="error-message">Please enter your name.</div><?php } ?>
<label for="email">Email</label>
<input type="text" name="email" id="email" value="<?php echo $_POST['email'] ?>" />
<?php if($emailError){ ?><div class="error-message">Please enter a valid email.</div><?php } ?>
<input type="submit" value="Submit" class="submit" />
</form>
<?php }else{ ?>
<p><small>Thank you, the form has been successfully submitted!</small></p>
<?php } ?>
I get no database errors. The form will be more substantial, but I can't get it to work with these two fields. Any suggestions? Any help? Thanks very much...