Page 1 of 1

Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 5:39 pm
by jjfinley2001
Help!!! I cannot figure out what is wrong with this code. I cannot type a lower case a into the search box on my site. Please help as I am desperate!
Thank you

Code: Select all

<?php
include("controlpanel/includes/connection.php");
include("includes/functions.php");
$linkid=db_connect();
ob_start();
session_start();
    if($_REQUEST['mode']=="search")
    {
        $_SESSION['_check']="";
        $valid="Yes";
        if($_REQUEST['Keyword']=="")
        {
            $_SESSION['_check'].="Please enter your Keyword<br><br>";
            $valid="No";
        }
        if($_REQUEST['Keyword']!="")
        {
            $str=$_REQUEST['Keyword'];
            $exp = "^[a-zA-Z]";
            if(eregi($exp,$str)){
            }
            else
            {
                $_SESSION['_check'].="Please enter only Alphabets<br><br>";
                $valid="No";
            }
        }
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ornaments by Occasion</title>
<link href="includes/style.css" rel="stylesheet" type="text/css">
<script src="includes/validate.js" type="text/javascript"></script>
<script type="text/javascript">
function fnValidate(){
    document.thisForm.submit();
}
    
function imposeMaxLength(Object, MaxLen)
{   
    
    if(Object.value.length>MaxLen)
        Object.value=Object.value.substring(0,MaxLen)
    return (Object.value.length <= MaxLen);
}
</script>
</head>
<body>
    <table border="0" cellpadding="0" cellspacing="0" width="850" align="center">
        <tr>
            <td valign="top" colspan="2" width="850" class="top_menu">
            <? echo fnTopMenu();  ?>
            </td>
        </tr>
        <tr>
            <td colspan="2" valign="top" width="850" height="102">
                <a href="index.php"><img src="images/logo.gif" width="411" height="102" alt="" border="0"></a><img src="images/banner_home.jpg" alt="" width="439" height="102" border="0" usemap="#Map"><br>
          </td>
        </tr>
        <tr>
            <td valign="top" width="214" class="content_left">
                <? echo fnLeftProduct(); ?>
            </td>
            <td valign="top" width="634" class="content_right">
                <a href="products.php"><img src="images/banner2.jpg" width="634" height="139" alt="" border="0"></a><br>
                <div class="heading2"><b>Search Product</b></div>
                <div class="content_right_txt"> 
                <form name="thisForm" method="post" action="search.php?mode=search">
                    <table border="0" cellpadding="10" cellspacing="0" width="100%">
                        <tr>
                            <td colspan="2">
                                <? if($_SESSION['_check']!="") { ?>
                                <div style="border:#D5D5D5 1px solid; font-weight:bold; color:#FF0000; background:#EAEAEA; padding:10px;"><?  echo $_SESSION['_check'].""; $_SESSION['_check']=""; ?></div>
                                <? } ?>
                                <p class="form_des">Fill out the form below to find out more information about our services and how we can help you.</p>
                                <? if($_SESSION['msg']!="") echo $_SESSION['msg']."<br><br>"; $_SESSION['msg']=""; ?>
                            </td>
                        </tr>
                        <tr>
                            <td width="70">Keyword</td>
                            <td>
                                <input type="text" onkeypress="javascript&#058; return AllowNumeric(event);" name="Keyword" class="txtbox" maxlength="15" value="<? echo $_REQUEST['Keyword']; ?>">
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <img src="images/search_btn.gif" onClick="return fnValidate();" width="84" height="35" alt="" class="crsr">
                            </td>
                        </tr>
                    </table>
                </form>
                <br>
                
                <table border="0" cellpadding="3" cellspacing="0" align="center" width="600" class="product">
                
                <?
                
                if($_REQUEST['mode']=="search" && $_REQUEST['Keyword']!="")
                {
                    echo '<tr><td colspan="2"><b class="head_txt">Search Results</b></td></tr>';
                    
                    if($_REQUEST['Keyword']=="")
                        $sql = "select * from product where Status='Active' ORDER BY PId";
                    else
                        $sql = "select * from product where (Name like '%".$_REQUEST['Keyword']."%' or Price like '%".$_REQUEST['Keyword']."%' or Description like '%".$_REQUEST['Keyword']."%' or StockCode like '%".$_REQUEST['Keyword']."%'or Space like '%".$_REQUEST['Keyword']."%')  and Status='Active' ORDER BY PId";
                    
                    $res=mysql_query($sql);
                    $numrows=mysql_num_rows($res);
                    if($res>0){
                        $count=2;
                        $numrows=mysql_num_rows($res);
                    }
                    
                    //pager starts Here
                    if($_REQUEST['page']=="")
                        $page =1;
                    else
                        $page=$_REQUEST['page'];
                        $total  =   $numrows;
                        $limit  =   20;
                        $pager  =   Pager::getPagerData($total, $limit, $page);
                        $offset =   $pager->offset;
                        $limit  =   $pager->limit;
                        $page   =   $pager->page;
                    //pager ends Here
                    $res=mysql_query($sql." limit  $offset, $limit"); 
                    if($res>0){
                        $numrows=mysql_num_rows($res);
                    }
                    if ($numrows>0)
                    {
                        while($obj=mysql_fetch_object($res))
                        {
                            $count++;
                            
                            if($count%3==0)
                                echo'<tr>';
                                echo'<td valign="bottom" width="200" align="center">';  
                                echo'<a href="product_details.php?PId='.$obj->PId.'"><img src="product/'.$obj->Thumb.'" width="153" alt="" border="0" class="img_bdr1"></a><br>
                                <b class="title1">'.$obj->Name.'</b><br>
                                <b class="title1">Stock#:</b> '.$obj->StockCode.'<br>
                                <b class="title1">Price:</b> $ '.$obj->Price.'<br>
                                <table border="0" cellpadding="0" cellspacing="0" align="center">
                                    <tr><td><a href="product_details.php?PId='.$obj->PId.'"><img src="images/view_btn.gif" width="94" height="40" alt="" border="0"></a></td>';
                                    if($obj->Qty!=0 && $obj->Qty!="")
                                        echo '<td><a href="cart.php?mode=save&PId='.$obj->PId.'"><img src="images/buy_btn.gif" width="89" height="36" alt="" border="0"></a></td>';
                                    else
                                        echo '<b class="red_txt">Sorry, No Stock!</b>';
                                    echo '</tr>
                                </table>
                            </td>';
                            if($count%3==2)
                                echo'</tr>';
                        }
                    } 
                    else
                        echo '<tr><td colspan="2"><b class="red_txt">Sorry, no matches found regarding your Search. Please redefine your Search.</b></td></tr>';
                    
                    ?>
                    
                    <? if ($numrows>0){ ?>
                    <?
                    if($total > $limit) 
                    {
                    echo "<tr><td colspan='20' bgcolor='#ffffff'>";
                    ?>
                    
                    <?
                        echo"<table bgcolor='#ffffff' cellpadding='0' cellspacing='0' border='0' align='center' width='400'>";
                        echo"<tr><td><b>Page: </b>";
                        $colcount=15;
                        $currentcount=$colcount;
                        for ($i = 1,$j=1; $i <= $pager->numPages; $i++)
                            {  
                            $j++;   
                            if($currentcount >= $colcount) 
                                $currentcount=0;
                            $currentcount++;
                        //Page Content Start Here
                            if ($i==$pager->page) 
                                {
                                if($j > $colcount) 
                                    {
                                    echo"<br><img src='././image/spacer.gif' width='37' height='1'>";
                                    $j=1;
                                    }   
                                echo "<span class='boxpage2'><b>&nbsp;$i&nbsp;</b></span>";    
                                }
                            else 
                                { 
                                if($j > $colcount) 
                                    {
                                    echo"<br><img src='././image/spacer.gif' width='37' height='1'>";
                                    $j=1;
                                    }   
                                echo "<span class='boxpage'>&nbsp;<a class='boxlink' href='search.php?page=$i&CId=$_REQUEST[CId]'>$i</a>&nbsp;</span>";
                                }
                        //Page Content Ends Here
                            } 
                        $prev=$pager->page-1;
                        $next=$pager->page+1;
                        echo "<td align='right' class='body-txt-lrg'>";
                        if(($pager->page!=1)&&($total>$limit))
                        echo "&nbsp; <a href='search.php?page=$prev&CId=$_REQUEST[CId]' class='normlink'><b>&laquo; Prev</b></a>"; 
                        if($pager->page!=$pager->numPages)
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='search.php?page=$next&CId=$_REQUEST[CId]' class='normlink'><b>Next &raquo;</b></a>"; 
                        echo "</td></tr></table>";
                        } 
                        echo "</td></tr>";
                    }
                }
                ?>
                </table>
                </div>
          </td>
        </tr>
        <tr>
            <td valign="top" colspan="2" height="69" class="footer">
                <? echo fnFooter(); ?>
            </td>
        </tr>
    </table>
 
<map name="Map">
<area shape="rect" coords="207,6,432,96" href="products.php">
</map>
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-8855903-1"); pageTracker._trackPageview(); } catch(err) {}</script>
</body>
</html>

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 5:44 pm
by requinix
Wrap all that code in tags. Right now.

If you can't type 'a' then it's not a PHP problem, it's something with your computer and/or keyboard.

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 5:54 pm
by jjfinley2001
Please excuse my newbiness...but what do you mean by
tasairis wrote:Wrap all that code in tags. Right now
Thanks

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 6:48 pm
by requinix
Click the Image icon in your post, then add the tags like

Code: Select all

<?php
include("controlpanel/includes/connection.php");
 
...
 
</body>
</html>
The first half goes immediately before the code begins, the second half goes immediately after it ends.

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 7:05 pm
by jjfinley2001
jjfinley2001 wrote:The first half goes immediately before the code begins, the second half goes immediately after it ends.
Thank you. I tried it but still doesn't work on any of my computers or friends computers. Hmmm hope someone can fix this...Help!!

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 8:13 pm
by John Cartwright
jjfinley2001 wrote:
jjfinley2001 wrote:The first half goes immediately before the code begins, the second half goes immediately after it ends.
Thank you. I tried it but still doesn't work on any of my computers or friends computers. Hmmm hope someone can fix this...Help!!
Worked fine for me when I edited your post :wink:

Please make sure you use the proper tags next time.

Re: Cannot type the letter lowercase a into search box on site

Posted: Thu Oct 08, 2009 8:21 pm
by jjfinley2001
Did it work when it before you edited my post? What edits are you talking about?