tags:

views:

299

answers:

4

If I set my Form method to GET it will send the action page something like this:

action_page.php?key=value&foo=bar

But is there a way to make it send like this:

action_page.php#key=value&foo=bar

Because the page receiving the values relies on hash variables.

Thanks!

+2  A: 

You can do such a thing using javascript by appending to:

window.location.hash
Dmitri Farkov
A: 

You could use javascript to dynamically create URL parameters like that from the form values.

codymanix
+3  A: 

you can set up a "middle man" page which redirects the data like so

middleman.php:

<?php

$string = 'realpage.php#' . $_SERVER['QUERY_STRING'];

header('location: ' . $string);

?>

so in your form u would do:

<form action="middleman.php" method="get">

and that would send to middleman.php which inturn would redirect to realpage.php with the hash.

Ozzy
A: 

Are you sure that the page depends on 'hash variables'? That would be a very odd way to design a system. In particular, the elements after the hash are not guaranteed to be sent by the browser to the server, and in fact in most cases they are not. That means your PHP script will never receive the variables.

Daniel Roseman
PHP is not what is looking for them, its an Ajax app.
John Isaacks