?
Solved

alert not working

Posted on 2005-03-30
2
Medium Priority
?
183 Views
Last Modified: 2011-10-03
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
Comment
Question by:ellandrd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 2000 total points
ID: 13662795
if (document.searchForm.submittedquery.value = "")

should be

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

Not assignment("="), but comparison("==")
0
 
LVL 16

Author Comment

by:ellandrd
ID: 13662859
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

777 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