?
Solved

submit button for textfield problem

Posted on 2005-04-06
6
Medium Priority
?
303 Views
Last Modified: 2010-04-09
Hi,

i have a textfield with a submit button next to it which allows the uder to enter in a number and proceed to the nect page to view a specific order. my problem is that when the users presses the submit button everything works fine but if they press enter it gives an error?

why is this?

thanks!

ps: im developing in php and mysql.
0
Comment
Question by:clonmelog
6 Comments
 
LVL 2

Author Comment

by:clonmelog
ID: 13722840
by the way i have code on the next page:

if(isset($_POST["Submit"]))
{

is this something to do with it?
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 13723011
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 13723026
Sorry I think my last post is unrelated, try this
http://www.codecomments.com/archive227-2004-4-177039.html
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Accepted Solution

by:
RozanaZ earned 525 total points
ID: 13724189
<HTML>
<HEAD>
<TITLE></TITLE>
<script>
      function subOnEnter(myform) {
      if (window.event && window.event.keyCode == 13)
        {
         myform.submit();
        }
      else
        {
             return true;
         }
    }
</script>
</HEAD>

<BODY onLoad="javascript: subOnEnter(document.getElementById('f1'))">
<table>
      <tr>
            <td>
                  <form name="f1" id="f1" action="http://1.1.1">
                        <input type="text" id="t1" name="t1"><br>
                        <input type="submit">
                  </form>
            </td>
      </tr>
</table>
</BODY>
</HTML>
0
 
LVL 3

Expert Comment

by:azcn2503
ID: 13725131
It might be that the Submit element was not included because it was not clicked, try using this code in your PHP just to test whether there are any $_POST variables:

if($_POST){
// Your actions
}

Simple!
0
 
LVL 3

Assisted Solution

by:azcn2503
azcn2503 earned 225 total points
ID: 13725147
Also, if you want to check whether this is the way it is working, try printing the $_POST array like so:

<?php
if($_POST){
echo("<pre>");
print_r($_POST);
echo("</pre>");
}
?>

Just check whether the Submit button is included when you submit (it may or may not be, but I thought it would as long as it is named).

I'm not able to test this as my local server has been down for a couple of days.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

850 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