Hi,
I am having some issues with a form validation feature I am trying to add to a register form.
I have a test case where a user can enter a username and a check is made against a database to see if that username is available.
http://www.benfoord.com/test/uname_validation/registration.php
Try typing in ‘admin’ - this results in negative feedback. Anything else over 4 characters will be allowed.
The page I am trying to add this feature too is…
http://www.fitnessfilter.com/ee/venue/register
So that when you type in Venue Name the Username is written for you - with spaces rewritten as ‘-’.
However when the user types in a username it ends up rendering a full replication of the html page??!
I am very confused as to why this is. The following code is used…
Then this references the check.php file which has this code…
<?php
// This is a sample code in case you wish to check the username from a mysql db table
if(isSet($_POST['trading_name']))
{
$username = $_POST['trading_name'];
$dbHost = 'localhost'; // usually localhost
$dbUsername = '';
$dbPassword = '';
$dbDatabase = '';
$db = mysql_connect($dbHost, $dbUsername, $dbPassword)
or die ("Unable to connect to Database Server.");
mysql_select_db ($dbDatabase, $db)
or die ("Could not select database.");
$sql_check = mysql_query("SELECT username FROM exp_members WHERE username='".$trading_name."'")
or die(mysql_error());
if(mysql_num_rows($sql_check))
{
echo '<font color="red">The username <strong>'.$trading_name.'</strong>'.' is already in use.</font>';
}
else
{
echo 'OK';
}
}
?>I’m wondering if there is something for me to sort regarding the location of the files. They are positioned on the server here… fitnessfilter.com/ee/[system]/template_files/default_site/venue.group
But with a htaccess file and the Expression Engine re-writing the url, the files in this location display as on the url…
http://www.fitnessfilter.com/ee/venue/register
Thanks
Ben