Help with Javascript alert

  • jordonshaw
  • Student
  • Student
  • User avatar
  • Joined: Dec 30, 2008
  • Posts: 91
  • Loc: Tennessee
  • Status: Offline

Post February 16th, 2010, 12:02 am

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
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 16th, 2010, 12:02 am

  • jordonshaw
  • Student
  • Student
  • User avatar
  • Joined: Dec 30, 2008
  • Posts: 91
  • Loc: Tennessee
  • Status: Offline

Post February 16th, 2010, 12:13 am

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 207 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
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.