Hi
Here is my first work with chronoforms. I need to do the following:
Validate an entry in a Table (named registo) This validation is made with fields email and password. If the user is valid I want to redirect him to one website that is in the field Destino (in the table registo). Here is my code in server side validation
Easy, no? But I have one problem who can I get the field Destino in my table?
I try
but I had no lucky
After I got the $segue value I only have to do is
Here is my first work with chronoforms. I need to do the following:
Validate an entry in a Table (named registo) This validation is made with fields email and password. If the user is valid I want to redirect him to one website that is in the field Destino (in the table registo). Here is my code in server side validation
<?php
$email=$_POST['Email'];
$passe=$_POST['Passe'];
$db =& JFactory::getDBO();
$query = "
SELECT * from registo WHERE Email='$email' and Passe='$passe'
";
$db->setQuery($query);
if ( $db->loadResult() ) {
return "You are Registed";
}
?>
Easy, no? But I have one problem who can I get the field Destino in my table?
I try
$segue=db->Destino
but I had no lucky
After I got the $segue value I only have to do is
header("Location:'$segue'");
Hi lopezio,
You can do this in serverside validation - but that box is intended for validation and should only 'return' a result if the validation fails.
Bob
You can do this in serverside validation - but that box is intended for validation and should only 'return' a result if the validation fails.
<?php
$email = JRequest::getString('Email', '', 'post');
$passe = JRequest::getString('Passe', '', 'post');
$db =& JFactory::getDBO();
$query = "
SELECT `Destino`
FROM `registo`
WHERE `Email` = '$email' AND `Passe` = '$passe'
";
$db->setQuery($query);
$destino = $db->loadResult();
if ( $destino ) {
global $mainframe;
$mainframe->redirect($destino);
} else {
return "You are not Registered";
}
?>
Not tested and will need debugging.Bob
Hi Greyhead
Thank you for your help but I think the code is not correct. Please look the following
$destino get's the value 1 (if registed) and we can't redirect to 1.
In this point I need to catch the value of the Field Destino in Table registo (the same table I use to validate the user)
My question is: How can I retrive the value of the field Destino?
Thank you
Thank you for your help but I think the code is not correct. Please look the following
$db->setQuery($query);
$destino = $db->loadResult();
if ( $destino ) {
global $mainframe;
$mainframe->redirect($destino);
$destino get's the value 1 (if registed) and we can't redirect to 1.
In this point I need to catch the value of the Field Destino in Table registo (the same table I use to validate the user)
My question is: How can I retrive the value of the field Destino?
Thank you
Found it
Here is the code:
Here is the code:
<?php
$email=$_POST['Email'];
$passe=$_POST['Passe'];
$db =& JFactory::getDBO();
$query = "
SELECT * from registo WHERE Email='$email' and Passe='$passe'
";
$db->setQuery($query);
$destino = $db->loadResult();
if ( $destino ) {
global $mainframe;
$row = $db->loadRow();
$mainframe->redirect($row[3]);
} else {
return "You are not Registered";
}
?>
Hi
One more point about this question. Is possible to redirect to another chronoform form?
Thank you
One more point about this question. Is possible to redirect to another chronoform form?
Thank you
This topic is locked and no more replies can be posted.