Solved

How to get form action right

Posted on 2014-03-09
3
248 Views
Last Modified: 2014-03-10
In a list of links this code is used:

echo '<form action="tinymce/edit_tinymce.php?sort='.$id.'">
        <tr>
          <td>&nbsp;</td>
          <td style="background-color: #E5EDF6"><span class="brodrubrik">Redigera resa till '.$plats.' den '.$datum.'</span></td>
          <td style="background-color: #E5EDF6"><input type="submit" name="B2" id="B2" value="G&aring; dit" >
          </span></td>
          <td>&nbsp;</td>
        </tr>
        </form>';

Open in new window

The url is correct when in the browser the cursor is put on the button. But when the button is pressed and the new page comes up the url is displayed awkwardly in the browser's address field.
I had expected to get http://www.whaterver.com/tinymce/edit_tinymce.php?sort=x but instead I get http://www.whaterver.com/tinymce/edit_tinymce.php?B2=G%E5+dit.

Please, experts, teach me how to get it right.
0
Comment
Question by:lericson
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39916585
That's what happens, the querystring is set with the values in the FORM - if there is already something there then it will be replaced.
Put your sort value in an hidden field

This bit
B2=G%E5+dit.

Is your submit button and its normal for it to be passed in the querystring as well, unless you remove the name attribute

You can get around it by specifying the method as POST then the url in the action field will be untouched as the form values are passed invisibly
<form method="POST" ...
0
 

Author Closing Comment

by:lericson
ID: 39917118
Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question