Solved

How to get form action right

Posted on 2014-03-09
3
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

617 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