Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['example']) && (isset($_POST['actual_position']) && !empty($_POST['actual_position'])) && (isset($_POST['final_position']) && !empty($_POST['final_position']))) {
- $actual_link = 'http://' . $_SERVER['HTTP_HOST'] . '/test.php';
- $actual_link.= '?actual_position=' . $_POST['actual_position'] . '&final_position=' . $_POST['final_position'];
- // As you see over the variable $actual_link now contains the name and the values from the HTML input fields.
- //
- // This task could also be done easily by removing this php if condition and replace the HTML form method from POST to GET.
- // The reason I am using this example is just in case you want to extend the link with more data.
- // Maybe you need some data from your database? What do I know?
- // Lets add more data to the link
- $actual_link.='&more_data=a_value';
- header('Location: ' . $actual_link); return;
- }
- echo '
- <form method="POST">
- <label for="actual_position">
- <span>From: <span class="required"></span></span>
- <input name="actual_position" type="text" maxlength="512" id="actual_position" class="searchField"
- value="' . (!empty($actual_position) ? $_GET['actual_position'] : '') . '" />
- </label>
- <label for="final_position">
- <span>To: <span class="required"></span></span>
- <input name="final_position" type="text" maxlength="512" id="final_position" class="searchField"
- value="' . (!empty($final_position) ? $_GET['final_position'] : '') . '" />
- </label>
- <input type="submit" name="example" value="Start redirect">
- </form>
- ';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement