Re: auto download
| From: | Benjamin Adams | Date: | Wed, 22 Feb 2006 18:38:27 +0000 |
| Subject: | Re: auto download | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230898@lists.php.net to get a copy of this message | ||
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 helphttp://us2.php.net/header --John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php