Re: auto download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have it working with javascript but the if statements are not working:
<?php
$num_download = rand(0,100);
echo $num_download;
if($num_downlaod <= 50){
?>
<script type="text/javascript">
       window.open('<?=$conf[$links]['link1']?>');
       </script>
<?php
}else if(($num_download > 50) && ($num_download <= 75) && ($conf [$links]['link2'] != '')){
?>
<script type="text/javascript">
       window.open('<?=$conf[$links]['link2']?>');
       </script>
<?php
}else if(($num_download > 75) && ($num_download <= 100) && ($conf [$links]['link3'] != '')){
?>
<script type="text/javascript">
       window.open('<?=$conf[$links]['link3']?>');
       </script>
<?php
}else{
?>
<script type="text/javascript">
       window.open('<?=$conf[$links]['link1']?>');
       </script>
<?php
}
?>

Only the first if runs and is true all the time.
What is wrong with the code?

On Feb 22, 2006, at 12:41 PM, John Nichel wrote:

Benjamin Adams wrote:
I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me "Warning: Cannot modify header information"
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new window.
Thanks for any help

http://us2.php.net/header

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux