TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Setting "submit" (http://www.talkphp.com/general/5442-setting-submit.html)

maeltar 06-08-2010 06:31 PM

Setting "submit"
 
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 ???

delayedinsanity 06-08-2010 08:11 PM

I'm completely unsure if I'm following you here, but I think what you want is to use GET instead of POST and set some hidden fields to determine the values of query vars like d_height, etc.

SaintIsaiah 06-08-2010 08:19 PM

I think he wants the ability of either posting the form data or getting the equivalent information from a url. If so, this may be the solution.

You can add the ability of checking if the same variables are set from the "$_GET" method.

But if this form is posting to a database, I wouldn't advise using "$_GET" at all. It's one of the easiest ways of injecting information into the SQL.

maeltar 06-08-2010 08:33 PM

Have gone along the lines of using a hidden field and checking that, so thanks anyway guys :D

Pinacolada 06-10-2010 05:36 PM

Try to use form builder for installation neccesary options of php form.


All times are GMT. The time now is 04:35 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0