how to disable button for single user in php
Get the solution ↓↓↓Can Anyone tell me how to disable button for single(specific) user in php. I have tried these code but did not work.
<div class="form-group text-center">
<input disabled="true" type="submit" value="<?php echo $this->lang->line('text_btn_submit'); ?>" name="social_submit" class="btn btn-primary " <?php
if ($this->system->demo_user == 1) {
echo 'disabled';
}
Answer
Solution:
I did something similar by creating a field in my database with a role. If the user is a user account, he/she could not access particular link.
Answer
Solution:
In oreder to make something for a specific user, you first need to identify the user. The most common way to do so is by creating a login system. It means that every time, every user would have to login to your website/app with a username and a password.
In order to make a login system, you need to build a page that gets a username and a password and check if this user exists in your database. You can read more about login system in the internet, and maybe take ideas from others.
Another thing you can do is identify the user withSESSION
s.
You can read about sessions more in the internet (or ask here a new question) but in general, sessions are variables which are saved on the server, and they are multi-page variables (it means that even if the user go to another page, the variable will still hold its original value).
Therefore, it means that if a user (the specific one you are talking about) do something "special", you can define a$_SESSION
variable that will hold the value'thisOne'
and then you can check the session to know if a user is the specific user you want to identify.
Finally,
After making something which can identify the user identity, you can easily make adisabled
attribue in input tags after writing some<?php something-that-checks-the-user-identity ?>
Answer
Solution:
You can write your phpif
condition inline. Try this code.
I've removed disabled='true' (It should be enabled by default)
if ($this->system->demo_user == 1)
then disable button.
<div class="form-group text-center">
<input type="submit" value="<?php echo $this->lang->line('text_btn_submit'); ?>" name="social_submit" class="btn btn-primary " <?php if ($this->system->demo_user == 1)echo 'disabled'; ?> >
</div>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: object not found by the @paramconverter annotation.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.