A
A
Alexander2018-03-17 22:57:35
PHP
Alexander, 2018-03-17 22:57:35

How to redirect a person with a get request?

A person entering the cart goes to page ../page_order.php?action=onclick
If he goes to page ../page_order.php, the page will be displayed clumsily.
How to make it so that when going to ../page_order.php it would be transferred to ../page_order.php?action=onclick via a GET request, or maybe somehow differently?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2018-03-17
@402d

if I don't have a variable, then it takes the default value.

P
Paul Denisevich, 2018-03-17
@deniamnet

At the beginning of the script we write:

if ( ! isset($_GET['action']) || $_GET['action'] !== 'onclick') {
    header('Location: ' . PHP_SELF . '?action=onclick'); exit(0);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question