Select a value to pass

I’m working on a control to redirect to a form.
The control select ask for the name and password then would have to select the employe_id corresponding to these values.
So far, I could not get it to work:

[v_user] = {employee_id};
[usr] = {name};
$pwd = {password};
$sql = “SELECT employee_id, name, password
FROM
employee
WHERE
(name = '”.[usr]."’) AND
(password = ‘".$pwd."’) AND
(employee_id = ‘".[v_user]."’)";
sc_lookup(ds, $sql);
if (isset({ds[0][0]}))
{
sc_redir(form_1,v_user={employee_id},"_self");

 }

else
{
echo “wrong username or password”;
}

Using sc_alert({no_employe}); it always returns a 0. Why?
I need the employee_id to pass it to the form but I want to avoid having the end user to enter it in the control…
Does anyone have an idea how to do it?

Please look first at a PHP beginners tutorial and a SQL Tutorial

Using sc_alert({no_employe}); it always returns a 0. Why?

The field {no_employe} has not been addressed …

Look at this code:



[v_user] = 0;

$user_name = {name};
$user_pass = {password};

$sql = "SELECT employee_id FROM employee WHERE name = '" . $user_name . "' AND password = '" . $user_pass . "'";

sc_lookup(ds, $sql);

if (isset({ds[0][0]}))
{
   {employee_id} = {ds[0][0]};
   sc_redir(form_1.php, v_user={employee_id}, "_self");
}
else
{
   echo "wrong username or password";
}

I meant sc_alert({employee_id}); Sorry.
Thank you for the links, I am reading them right now and I am certain this knowledge will prove to be usefull.