title: successful/fail message pop up box after submit?
body: <p>Basically after clicking the submit button, I want a pop up box to pop up saying successful or fail, then clicking OK to confirm the message. At the moment i am getting a pop up box "undefined" followed by failed message pop up box.  <strong>HELP PLEASE!</strong></p>
  
  <p>here is the script</p>
  
  <pre><code>&lt;?php
  include ('config.php');
  
  if (isset($_POST['name'])) {
  
  $name = "name";
  
  $query = "INSERT INTO pop ('id','name') VALUES ('','$name')";
      $result = mysql_query($query,$cn);
      if ($result) {
      echo "&lt;script type='text/javascript'&gt;alert('submitted successfully!')&lt;/script&gt;";
  }
  else
  {
      echo "&lt;script type='text/javascript'&gt;alert('failed!')&lt;/script&gt;";
  }
  }       
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;form action="" method="post"&gt;
      Name:&lt;input type="text" id="name" name="name"/&gt;
      &lt;input type="submit" value="submit" name="submit" onclick="alert();"/&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>