Answer the question
In order to leave comments, you need to log in
How to organize logic?
On all pages of the site there is a button "Add task", which leads to the form for adding a task. There is a page with its own tasks ("My tasks"). There are two selects on the task adding form, which should not be displayed if the user has navigated from the "My Tasks" page.
Entered additional variable $display_users = 1, and then parse the url from which the user came:
$url = $_SERVER['HTTP_REFERER'];
$str = explode("//", $url);
$str_ = explode("/", $str[1]);
if ($str_[2] == 'my') {
$display_users = 0;
}
<?php if ($display_users) : ?>
// показываю
....
<?php else: ?>
// создаю скрытое поле, необходимое мне в дальнейшем
<input type="hidden" name="display_users">
<?php endif; ?>
if (isset($_POST['submit'])) {
....
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question