I need to create a form that uses a validation to verify that the email is already registered in the bank or not.
Below the source code of the form, this code is in "Form Code":
Best Regards,
Below the source code of the form, this code is in "Form Code":
<html>
<DIV class=form_item >
<DIV class="form_element cf_text" >
<SPAN class=cf_text >Confirmation e-mail</SPAN>
</DIV>
<DIV class=clear > </DIV>
</DIV>
<DIV class=form_item >
<DIV class="form_element cf_textbox" >
<LABEL class=cf_label >confirmação de e-mail</LABEL>
<INPUT class="cf_inputbox required validate-email" id=email maxLength=150 size=30 name=email >
</DIV>
<DIV class=clear > </DIV></DIV>
<?
$email=email;
//Checks if the email is valid
$sql = "SELECT * FROM jos_forms WHERE email='"$email"'") or die(mysql_error());
$linha = mysql_fetch_array($sql);
$rows = mysql_num_rows($sql);
if($rows == 0){
echo "E-mail is not registered in the database."
}
?>
</html>Best Regards,
Hi Henrique,
remove the 2 <html> </html> tags!
this is how the code should be in joomla :
change your code to be the same then check if $row is available or not !
Regards
Max
remove the 2 <html> </html> tags!
this is how the code should be in joomla :
$database =& JFactory::getDBO();
$query = "SELECT * FROM #__tablename WHERE id = '1'";
$database->setQuery( $query );
$row = $database->loadObject();change your code to be the same then check if $row is available or not !
Regards
Max
and I will move this to the HOW TO forums!
Max
Max
Hi Henrique,
You also can't do this check in the Form HTML unless you use AJAX/JavaScript to do the database lookup. The code you have here needs to go into the Server Side validation box I think.
Bob
You also can't do this check in the Form HTML unless you use AJAX/JavaScript to do the database lookup. The code you have here needs to go into the Server Side validation box I think.
Bob
Hi Friends,
Add the following code in the validation of the form:
code in HTML:
Happy 2009! Much peace and health ...
Best Regards!
Henrique Euler !
Add the following code in the validation of the form:
<?php
$result = text_1;
$database =& JFactory::getDBO();
$query = "SELECT * FROM jos_forms WHERE email = '$result'";
$database->setQuery( $query );
$row = $database->loadObject();
echo "$result";
?>Where "text_1" is the value entered by the user in the field:code in HTML:
...<INPUT class="cf_inputbox required validate-email" id=text_1 maxLength=150 size=30 name=text_1 >...I created a form where they met the first data from a user, and then in another form that only has a field of email used to confirm whether the user was successfully registered in the bank. I need only validate this second form but I am not getting. If you can help me please Thanks!Happy 2009! Much peace and health ...
Best Regards!
Henrique Euler !
Hi Henrique,
I think that you are not clear enough about what should happen when the user is found in the bank or not found, this makes a lot of confusion here and wastes your time because this can solved really quick, let us know what should happen in the case that the user is found, and what should happen in the case its not.
Regards
Max
I think that you are not clear enough about what should happen when the user is found in the bank or not found, this makes a lot of confusion here and wastes your time because this can solved really quick, let us know what should happen in the case that the user is found, and what should happen in the case its not.
Regards
Max
This topic is locked and no more replies can be posted.
