Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2012, 09:04 AM   PM User | #1
chrisiboy
New to the CF scene

 
Join Date: Oct 2012
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
chrisiboy is an unknown quantity at this point
Display and hide of form edits

Hi Guys,

Please help! I have a permission field in mysql database, so if that field is 1 then show all fields, if it is 0 then show only a few fields.. Below is my coding... Does not work at all, only displays all the values


private function getUserEditForm(AirtimeUser $user)//Edit form display
{
$permission == 1;
//Coding added by Chris
//Query the selects the permission number
$cmd = "SELECT
airtime_users.mod_user_permissions
FROM airtime_users
where airtime_users.mod_user_permissions = '$permission'";

if(!$cmd)
{
$output = "<form name=\"main\" method=\"post\">";//Output is set as a POST function
$output = $output . "<table width=100%>";//Create a table and display each texbox and value
$output = $output . "<tr><td>User Id</td><td>" . $user->get_airtime_user_id () . "</td></tr>";
$output = $output . "<tr><td>CDR Download permission</td><td><input type=text name=mod_download_cdr value=" . $user->get_mod_download_cdr () . "></td></tr>";
$output = $output . "<tr><td>SIM Summary download permission</td><td><input type=text name=mod_download_sim_summary value=" . $user->get_mod_download_sim_summary () . "></td></tr>";
$output = $output . "<tr><td>Username</td><td><input type=text name=username value=" . $user->get_username () . "></td></tr>";
$output = $output . "<tr><td>Password</td><td><input type=password name=passwd value=" . $user->get_passwd () . "></td></tr>";
$output = $output . "<tr><td colspan=2><a href=\"javascript:saveUser(" . $user->get_airtime_user_id () . ");\">Save User</a>";
$output = $output . "</td></tr>";
$output = $output . "</table></form>";
$result = $this->execCommand($cmd);
}
else
{
$output = "<form name=\"main\" method=\"post\">";//Output is set as a POST function
$output = $output . "<table width=100%>";//Create a table and display each texbox and value
$output = $output . "<tr><td>User Id</td><td>" . $user->get_airtime_user_id () . "</td></tr>";
$output = $output . "<tr><td>CDR Download permission</td><td><input type=text name=mod_download_cdr value=" . $user->get_mod_download_cdr () . "></td></tr>";
$output = $output . "<tr><td>SIM Summary download permission</td><td><input type=text name=mod_download_sim_summary value=" . $user->get_mod_download_sim_summary () . "></td></tr>";
$output = $output . "<tr><td>Allow user management</td><td><input type=text name=mod_user_add value=" . $user->get_mod_user_add () . "></td></tr>";
$output = $output . "<tr><td>Allow permission management</td><td><input type=text name=mod_user_permissions value=" . $user->get_mod_user_permissions () . "></td></tr>";
$output = $output . "<tr><td>Allow access to custom reports</td><td><input type=text name=mod_custom_reports value=" . $user->get_mod_custom_reports () . "></td></tr>";
$output = $output . "<tr><td>Allow access to interactive reports</td><td><input type=text name=mod_interactive_report value=" . $user->get_mod_interactive_report () . "></td></tr>";
$output = $output . "<tr><td>Username</td><td><input type=text name=username value=" . $user->get_username () . "></td></tr>";
$output = $output . "<tr><td>Password</td><td><input type=password name=passwd value=" . $user->get_passwd () . "></td></tr>";
$output = $output . "<tr><td>Parent User</td><td><input type=text name=parent_user_id value=" . $user->get_parent_user_id() . "></td></tr>";
$output = $output . "<tr><td colspan=2><a href=\"javascript:saveUser(" . $user->get_airtime_user_id () . ");\">Save User</a>";

if(!$user->isNewUser())//If not new user, only for edit
{
$output = $output . " :: <a href=\"javascript:setSimPermissions(" . $user->get_airtime_user_id () . ");\">Modify SIM permissions</a>";
$output = $output . " :: <a href=\"javascript:setReportPermissions(" . $user->get_airtime_user_id () . ");\">Modify Report permissions</a>";
}

$output = $output . "</td></tr>";
$output = $output . "</table></form>";
}

return $output;
}
chrisiboy is offline   Reply With Quote
Old 10-08-2012, 02:39 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,689
Thanks: 158
Thanked 2,184 Times in 2,171 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
$permission == 1;
That's the comparison operator and not the assignment operator.
Quote:
if(!$cmd)
That's meaningless as $cmd contains just a string (query). Don't you need to execute it by mysql_query() function ?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 AM.


Advertisement
Log in to turn off these ads.