Help with Javascript alert

  • jordonshaw
  • Student
  • Student
  • User avatar
  • Posts: 96
  • Loc: Tennessee

Post 3+ Months Ago

How would I make this work correctly?

Code: [ Select ]
$b10 = $_POST['av'];    
    $b10crs = "SELECT * from SNP_crs 
           WHERE (crs_id = {$b10})";       
    $b10results = mssql_query($b10crs, $connection);      
    $b10crs_select = mssql_fetch_array($b10results);
    if (is_null($b10crs_select['sec_link'])){
      JavaScript: alert('No link for Demo Section!');
    } else {
    redirect_to("{$b10crs_select['sec_link']}");
    }
  1. $b10 = $_POST['av'];    
  2.     $b10crs = "SELECT * from SNP_crs 
  3.            WHERE (crs_id = {$b10})";       
  4.     $b10results = mssql_query($b10crs, $connection);      
  5.     $b10crs_select = mssql_fetch_array($b10results);
  6.     if (is_null($b10crs_select['sec_link'])){
  7.       JavaScript: alert('No link for Demo Section!');
  8.     } else {
  9.     redirect_to("{$b10crs_select['sec_link']}");
  10.     }


I keep getting a error on my javascript line. I don't know a lot about javascript. I found something similar to this online and tried to make it work. Basically what I'm wanting to do is pop up an alert if there is no line for the selected class.

Any help would be greatly appreciated!

Thanks,
Jordon
  • jordonshaw
  • Student
  • Student
  • User avatar
  • Posts: 96
  • Loc: Tennessee

Post 3+ Months Ago

Nevermind, I figured it out. If anybody is looking to do this, you can do it by using this code:

Code: [ Select ]
$b10 = $_POST['av'];    
    $b10crs = "SELECT * from SNP_crs 
           WHERE (crs_id = {$b10})";       
    $b10results = mssql_query($b10crs, $connection);      
    $b10crs_select = mssql_fetch_array($b10results);
    if (is_null($b10crs_select['sec_link'])){
       echo "<script type=\"text/javascript\">
           alert('No link for Demo Section!');
           </script>";
    } else {
    redirect_to("{$b10crs_select['sec_link']}");
    }
  1. $b10 = $_POST['av'];    
  2.     $b10crs = "SELECT * from SNP_crs 
  3.            WHERE (crs_id = {$b10})";       
  4.     $b10results = mssql_query($b10crs, $connection);      
  5.     $b10crs_select = mssql_fetch_array($b10results);
  6.     if (is_null($b10crs_select['sec_link'])){
  7.        echo "<script type=\"text/javascript\">
  8.            alert('No link for Demo Section!');
  9.            </script>";
  10.     } else {
  11.     redirect_to("{$b10crs_select['sec_link']}");
  12.     }


Thanks,
Jordon

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 66 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.