Hey,
I need to make a sponsorship form for a online store...but for that i need to know how can I check if emails, name and surname are already in database on validation...
exemple below:
Your name :.............
Surname :...............
email :.................
You are invited by
Name :............
Surname :.........
email : ..........
In fact, the person can suscribe only if the "you are invited" part exists in database.
I don't know if i am clear...
I need to make a sponsorship form for a online store...but for that i need to know how can I check if emails, name and surname are already in database on validation...
exemple below:
Your name :.............
Surname :...............
email :.................
You are invited by
Name :............
Surname :.........
email : ..........
In fact, the person can suscribe only if the "you are invited" part exists in database.
I don't know if i am clear...
Hi dangee,
you are clear, you need to use a db query with the server side validation, show me your db table structure and I will show you a sample code!
Max
you are clear, you need to use a db query with the server side validation, show me your db table structure and I will show you a sample code!
Max
OK thanks...but i don't know what you mean by "db table structure" 😢 Where can I find that ? Is it jos_users ??
the table which will have the list of persons who can "invite" others
Max
Max
OK, so I guess it is jos_vm_user_info with fields last_name, first_name and user_email
Hi Dangee,
please show me the table structure for table jos_vm_user_info which has the full list of those who can invite others!
Cheers,
Max
please show me the table structure for table jos_vm_user_info which has the full list of those who can invite others!
Cheers,
Max
good, this is a sample code:
the code above needs to go into the server side validation box and the field of the invited by email should have the name "email"
Max
<?php
global $mainframe;
$database =& JFactory::getDBO();
$query = "SELECT * FROM `#__vm_user_info` WHERE user_email = '".$_POST['email']."'";
$database->setQuery( $query );
$result = $database->loadObject();
if(!$result)return "this user doesn't exist";
the code above needs to go into the server side validation box and the field of the invited by email should have the name "email"
Max
This is the result on validation. Debug is set to off.
<?php
$nv_email = $_POST['{text_8}'];
// Procédure stockée dans Joomla pour communiquer avec la DB
$db = & JFactory::getDBO();
$query = "SELECT email FROM #__users WHERE email = '$nv_email'";
$db->setQuery($query);
// Si email entré existe
$exist = $db->loadResult();
// On vérifie si les conditions sont remplies
if ( !empty($exist) ) {
return true;
} else {
return false;
}
?>
This topic is locked and no more replies can be posted.