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

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

alert not working

my alert isnt working?

can somebody take a look please:

<script language="Javascript">
function validate(frm)
      if (document.searchForm.submittedquery.value = "")
            alert('Sorry your search query was empty');
            return false;
            return true;

      $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>Issue Status</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>Box Code</th>
      <th>VPN Box no</th>

      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>
      print ("</table><br><a href=\"default.htm\" target=\"_self\">Search Again</a>");
      <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)">
1 Solution
if (document.searchForm.submittedquery.value = "")

should be

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

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

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