Vivid Lust Posted December 22, 2007 Share Posted December 22, 2007 Heres my code: <?php $rand = srand(1,2); header('Location: banner.php?id='$rand); ?> Please can someone tell me where im going wrong. Thanks milions! Vivid Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/ Share on other sites More sharing options...
Dane Posted December 22, 2007 Share Posted December 22, 2007 Are you outputting any HTML before using header() ? Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421126 Share on other sites More sharing options...
Vivid Lust Posted December 22, 2007 Author Share Posted December 22, 2007 Umm, thats the whole of the code that will be in random.php This is for a random affiliate program im making. Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421130 Share on other sites More sharing options...
Dane Posted December 22, 2007 Share Posted December 22, 2007 try <?php $rand = srand(1,2); header('Location: banner.php?id='.$rand.''); ?> change from srand to rand Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421133 Share on other sites More sharing options...
Dane Posted December 22, 2007 Share Posted December 22, 2007 Actually This works <?php $rand = rand(1,2); header('Location: banner.php?id='.$rand.''); ?> Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421135 Share on other sites More sharing options...
Vivid Lust Posted December 22, 2007 Author Share Posted December 22, 2007 Its not working for me :s http://imgsurf.wsnw.net/random.php Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421139 Share on other sites More sharing options...
Dane Posted December 22, 2007 Share Posted December 22, 2007 Are you using the same code yes? Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421140 Share on other sites More sharing options...
Vivid Lust Posted December 22, 2007 Author Share Posted December 22, 2007 i copy and pasted and it displayed the html white spaces All working fine now. Thanks muchly Link to comment https://forums.phpfreaks.com/topic/82808-solved-header-location-code-with-variable-not-working/#findComment-421141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.