Solved

How to get form action right

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 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