Solved

How to get form action right

Posted on 2014-03-09
3
234 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now