Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

alert not working

my alert isnt working?

can somebody take a look please:

<html>
<head>
<title></title>
<script language="Javascript">
<!--
function validate(frm)
{
      if (document.searchForm.submittedquery.value = "")
      {
            alert('Sorry your search query was empty');
            return false;
      }
      else
      {
            return true;
      }
}
//-->
</script>
</head>
<body>
<?

if(isset($_POST["submittedquery"]))
{
      $db = odbc_connect("venture","","");

      $query = (isset($_POST["submittedquery"]) && !empty($_POST["submittedquery"])) ? trim($_POST["submittedquery"]) : "";

      $result = odbc_exec($db,"SELECT * FROM ABBVetcoGrayTreesProjectDocuments WHERE Title LIKE '%$query%';");

      $num_rows = odbc_num_rows($result);

      print ("Search Query: <b><i>$query</i></b><br><br>");

      print ("There are $num_rows title(s) that contain the <b><i>$query</i></b>.<br><br>");

      print ("<table width=\"100%\" border=\"1\">");

      print ("<tr>
      <th>Project Code</th>
      <th>Project Document Code</th>
      <th>Project Document No</th>
      <th>Purchase Order No</th>
      <th>Vendor Name</th>
      <th>Revision No</th>
      <th>Revision Date</th>
      <th>Vendor Document No</th>
      <th>Sub-vendor</th>
      <th>Issue Status</th>
      <th>Title</th>
      <th>Field</th>
      <th>Issued for IDC</th>
      <th>Review Code</th>
      <th>Date Returned to Vendor</th>
      <th>Transmittal Number</th>
      <th>External Distribution</th>
      <th>Storage Location</th>
      <th>Electronic File Location</th>
      <th>Responsible Engineer</th>
      <th>Comments</th>
      <th>Box Code</th>
      <th>VPN Box no</th>
      </tr>");

      while ($row = odbc_fetch_array($result))
      {
            $pc = $row['Project Code'];
            $pdc = $row['Project Document Code'];
            $pdn = $row['Project Document No'];
            $pon = $row['Purchase Order No'];
            $vn = $row['Vendor Name'];
            $rn = $row['Revision No'];
            $rd = $row['Revision Date'];
            $vdn = $row['Vendor Document No'];
            $sv = $row['Sub-vendor'];
            $is = $row['Issue Status'];
            $t = $row['Title'];
            $f = $row['Field'];
            $ifi = $row['Issued for IDC'];
            $rc = $row['Review Code'];
            $drtv = $row['Date Returned to Vendor'];
            $tn = $row['Transmittal Number'];
            $ed = $row['External Distribution'];
            $sl = $row['Storage Location'];
            $efl = $row['Electronic File Location'];
            $re = $row['Responsible Engineer'];
            $cm = $row['Comments'];
            $bc = $row['Box Code'];
            $vbn = $row['VPN Box no'];

            print ("<tr>
            <td>$pc</td>
            <td>$pdc</td>
            <td>$pdn</td>
            <td>$pon</td>
            <td>$vn</td>
            <td>$rn</td>
            <td>$rd</td>
            <td>$vdn</td>
            <td>$sv</td>
            <td>$is</td>
            <td>$t</td>
            <td>$f</td>
            <td>$ifi</td>
            <td>$rc</td>
            <td>$drtv</td>
            <td>$tn</td>
            <td>$ed</td>
            <td>$sl</td>
            <td>$efl</td>
            <td>$re</td>
            <td>$cm</td>
            <td>$bc</td>
            <td>$vbn</td>
            </tr>");
      }
      print ("</table><br><a href=\"default.htm\" target=\"_self\">Search Again</a>");
}
else
{
      ?>
      <form method="post" name="searchForm" action="<? echo $_SERVER['PHP_SELF']; ?>">
      <input type="text" value="" name="submittedquery">
      <input type="submit" value="Search" name="submitBtn" onclick="return validate(this)">
      </form>
      <?
}
?>
</body>
</html>
0
ellandrd
Asked:
ellandrd
1 Solution
 
BatalfCommented:
if (document.searchForm.submittedquery.value = "")

should be

 if (document.searchForm.submittedquery.value == "")

Not assignment("="), but comparison("==")
0
 
ellandrdAuthor Commented:
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now