SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: form submission
-
Aug 5, 2009, 07:00 #1
- Join Date
- Apr 2007
- Posts
- 63
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
form submission
I have a form like this :
Code HTML4Strict:<form action="index.php" method="get"> <input type="hidden" id="task" name="task" value="<?=$searchType?>" /> <input type="hidden" name="ct" value=""/> <input type="hidden" name="option" value="com_classifiedsearch" />
Can i embed the staic values of some of the form fields in the form action like this?
Code HTML4Strict:<form action="index.php?option=com_classifiedsearch" method="get"> [INDENT]<input type="hidden" id="task" name="task" value="<?=$searchType?>" /> <input type="hidden" name="ct" value=""/> <input type="hidden" name="option" value="com_classifiedsearch" />[/INDENT]
-
Aug 5, 2009, 07:06 #2
- Join Date
- Apr 2007
- Posts
- 63
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Actually I want to change the form to something like this:
Code HTML:<form action="index.php?option=com_classifiedsearch" method="get"><input type="hidden" id="task" name="task" value="<?=$searchType?>" /> <input type="hidden" name="ct" value=""/> </form>
-
Aug 5, 2009, 07:28 #3
- Join Date
- Aug 2009
- Posts
- 75
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:if (something) {$a = '?option=com_classifiedsearch'; } print <<<_embed_ <form action="index.php$a" method="get"> .... _embed
-
Aug 5, 2009, 07:33 #4
- Join Date
- Aug 2009
- Posts
- 75
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sorry I didn't mean to post that, the WYSIWG thing freaked out on me, I didn't realize it had submitted, and you only have 60 seconds to correct errors.
I believe you can do what you asked about.
-
Aug 6, 2009, 00:14 #5
- Join Date
- Apr 2007
- Posts
- 63
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
But I have a feeling that the query string in the form action is being wiped out by the form fields when the form is submitted?
-
Aug 6, 2009, 09:27 #6
- Join Date
- Aug 2009
- Posts
- 75
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Now that you mention that... I believe that is right.
Ideally, you should just submit data via POST or GET, and not both at the same time.
You could do something like this
Code:<form action="index.php" . . . . <input value="com_classifiedsearch" type="hidden" name="blah" ..... /> ....
Code:if (($_SERVER['REQUEST_METHOD'] == 'POST') && ($_POST['blah'] == "com_classifiedsearch")) {do something}
-
Aug 6, 2009, 10:06 #7
- Join Date
- Dec 2005
- Posts
- 982
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You cannot have a query string in your form action if you are submitted a get, but you can if you are submitting a post.
Works:
Code:<form action="index.php?this=that" method="post">
Code:<form action="index.php?this=that" method="get">
MySQL v5.1.58
PHP v5.3.6
-
Aug 6, 2009, 11:13 #8
- Join Date
- Aug 2009
- Posts
- 75
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If BrandonK says it, that's good enough for me.
Bookmarks