I have code like this at my PHP code:
<?php
require('../../server.php');
$role = strtoupper($_POST['role']);
$pool = strtoupper($_POST['pool']);
$psh = strtoupper($_POST['comp']);
if($role = "POOL")
{
$query2 = "INSERT INTO m_login (email, password, role, company_id)
VALUES ('$email', '$pass', '$role', '$pool')";
}
else
{
$query2 = "INSERT INTO m_login (email, password, role, company_id)
VALUES ('$email', '$pass', '$role', '$psh')";
}
if (mysql_query($query2))
{
$whatdo = strtoupper("add user ").$id;
include_once('../../serverlog.php');
$querys = "INSERT INTO m_log (user_id, description, waktu) VALUES ('$user', '$whatdo', '$input')";
if(mysql_query($querys))
{
echo'<script>alert("Penambahan data berhasil!");</script>
<meta http-equiv="refresh" content="0; url=index.php" />';
}
else
{
echo mysql_error();
}
}
else
{
echo'<script>alert("Failed!");</script> <br/>'.mysql_error().'<meta http-equiv="refresh" content="10; url=index.php" />';
}
?>
my question is, am I wrong to create condition for query2? because when I ran the program, my data always get POOL result for the role, although I have select Admin or Supervisor, it always return POOL
I'm using for choosing the role at registration form. So when I choose option admin, it return pool, when I choose spv, it return pool.
Anyone can give me solution?
Sorry for my bad English
if($role = "POOL")should beif($role == "POOL")