tags:

views:

18

answers:

1

Driving me a bit nuts this one, have tried alsorts of combination's...

At the top of my file I have

PHP Code: if (!ISSET ($_POST['submit'])) which tests if the submit has been hit, if not displays the form....

What I'd like to be able to to is generate a link that would be processed directly by the php code that the form would normally be submitted to... (does that make sense ?)

so a generated link in the code looks like ..

PHP Code: echo '<a href="index.php?submit&s_type=' . $s_type . '&d_height=' . $d_height . '&j_ref=' . $j_ref . '&j_name=' . j_name . '">' . $j_ref . '</a>'; The link generated looks like ..

HTML Code:

index.php?s_type=partk&d_height=3312&j_ref=AS0001&j_name=j_name

I have tried setting "submit" with links like

HTML Code:

index.php?submit=submit&s_type=partk&d_height=3312&j_ref=AS0001&j_name=j_name

index.php?submit&s_type=partk&d_height=3312&j_ref=AS0001&j_name=j_name

How do I create a link that sets "submit so it gets processed rather than going through the form ???

+2  A: 

$_GET != $_POST

So, either change $_POST check to $_REQUEST check, or change those 'links' to forms full of hidden prefilled elements, with just the submitbutton.

Keep in mind links are sometimes precached, going the $_GET route is only acceptable if it does not alter data.

Wrikken
Thanks for that but does it answer my question about "setting submit" ?(maybe I'm missing the point)`index.php?submit=submit`will that set submit ?
Simon
Just used a work around by creating a hidden field setting that and then testing on that instead of the state of "submit" .. So sort of answered, but not really answered ...Thanks Anyway
Simon
You're indeed missing the point. As I said "..change $_POST check to $_REQUEST check...", i.e. `if (!ISSET ($_REQUEST['submit']))`. 'submit' is not a special value in any context, so whatever key you are checking for needs to be in there. And keep very much in mind not all post forms are suitable to be used as get url. To complicate things further that can be circumvented with javascript posts, but let's not go there yet. [edit: 'sort of answered'=>'sort of understood'. Don't bite the hand of people who are trying to help you for free...]
Wrikken
Sorry yes, I follow what you are saying and I now understand...I did not mean to be derogatory with my phrasing and apologise ...All good now using submit, thank you very much..
Simon