0

first.php

<?php
   $file_name='1.pdf';
?>
<script type='text/javascript'>
window.open('pdf/<?php echo $file_name;?>','_blank')
<script>
<?php
header('location:second.php');
?>

second.php

<?php
echo 'Welcome..!';

?>

In this above coding i have to run first.php it can't open pdf file new tab directly goto this second.php.

anyone have a solution for my problem.i have to view pdf file in new tab on this time first.php redirect to second.php.

4
  • Do the redirect in javascript. Commented Mar 30, 2015 at 11:27
  • how to do that pls give some examples Commented Mar 30, 2015 at 11:28
  • location.href = '/your/url/here'; Commented Mar 30, 2015 at 11:29
  • Opps. Sorry i didint see @Bulk introduce the location comment. That's correctly Commented Mar 30, 2015 at 11:41

1 Answer 1

1

Try the redirect with javascript.

<?php
$file_name='1.pdf';
?>
<script type='text/javascript'>
window.open('pdf/<?php echo $file_name;?>','_blank');
location.href = 'second.php';
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.