simon
simon

Reputation: 1485

how to redirect from a form to different page?

I would like to add a form in my page. When I click on the submit button it post some details.

<form action="http://toggletime.net/redirect.php" method="get">
<input type="text" name="url" />
<button type="submit">Search</button></form>

I can use GET or POST. But my problem is I want to create diffrent page for each POST or GET.

The actual URL will be like: http://toggletime.net/redirect.php?url=text
I want to redirect it to: http://toggletime.net/text

How can I do that?

Upvotes: 0

Views: 97

Answers (2)

simon
simon

Reputation: 1485

but here my problem in no such page like that. The page is not found.

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

how can i create page dynamically during each search? or is there any other way to solve it?

Upvotes: 0

ddinchev
ddinchev

Reputation: 34673

In redirect.php do this:

if (isset($_GET['url']) && !empty($_GET['url'])) {
    header("Location: {$_GET['url']}");
    exit;
}

Isn't this what you want?

Upvotes: 2

Related Questions