Jump to content

Recommended Posts



<table cellpadding="0" cellspacing="0" width="954" border="0" height="258" bgcolor="FFFFFF">
<tr><td colspan="2">
<center><br>
<form method="post">
<table cellpadding="0" cellspacing="0" width="380" height="30">
        <tr>
                         <td width="297" valign="middle">
                <input type="text" name="gosearch" size="40">
                </td>
                <td width="108">
                <input type="submit" value="Go Search" name="search">
                </td>
                </tr></form>
</table>

Try this, you had the form ending before the table.  I also converted your width and valign to proper css.

 

<form method="post" enctype="multipart/form-data">
<table cellpadding="0" cellspacing="0" width="380" height="30">
        <tr>
			<td style="width: 297px; vertical-align: middle;"><input type="text" name="gosearch" size="40" /></td>
			<td style="width: 108px; vertical-align: middle;"><input type="submit" value="Go Search" name="search" /></td>
		</tr>
</table>
</form>

I tried and still having the same problem. When I type in a word in the text area and click on go search button everything works but if I just type in the word and press the enter key on the keyboard I don`t get any results.

 

How can I code this so when user hits the enter key on the keyboard.

 

if(isset($_POST['search']) ){

//Submit button hit or Enter button hit

}


The script below works on enter, I just tested it.  If this doesn't work for you then please post your code so we can see the issue.

 

<?php
if(isset($_POST['gosearch'])){
  echo $_POST['gosearch'];
}
?>
<html>
<head>
</head>
<body>
<form method="post" enctype="multipart/form-data">
   <table cellpadding="0" cellspacing="0" width="380" height="30">
           <tr>
            <td style="width: 297px; vertical-align: middle;"><input type="text" name="gosearch" size="40" /></td>
            <td style="width: 108px; vertical-align: middle;"><input type="submit" value="Go Search" name="search" /></td>
         </tr>
   </table>
</form>
</body>
</html>

Thanks for the information. I got it to work :D

I change code around that you submited. I remove input submit name and change text area name to keywords. Thanks for the help

 

if(isset($_POST['keywords'])){

//it works

}

 

<form method="post" enctype="multipart/form-data">
<table cellpadding="0" cellspacing="0" width="380" height="30">
        <tr>
			<td style="width: 297px; vertical-align: middle;"><input type="text" name="keywords" size="40"/></td>
			<td style="width: 108px; vertical-align: middle;"><input type="submit" value="Go Search" /></td>
		</tr>
</table>
</form>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.