I am trying to retrieve parts of the getcwd() method and inserting them into window.open()
the current getcwd() gives me this C:\wamp\www\qa4u\qa4u_working\Presenter
Using this code :
<?php
if(isset($_POST['genPDF'])){
foreach($_POST['email'] as $email)
{
$eid=$_POST['eid'];
?>
<script type="text/javascript" language="Javascript">
<?
$stringlink = getcwd();
$pieces = explode('\\', $stringlink);
?>
window.open("http://"+"<?php echo $_SERVER['HTTP_HOST']?>"+"/"+"<?php $pieces[3]?>"+"/"+"<?php $pieces[4]?>"+"/"+"<?php $pieces[5]?>"+"/genPDF.php?eid=<?php echo $eid ?>&email=<?php echo $email ?>");
</script>
<?php
}
}
?>
I am trying to achieve this instead :
window.open("http://qna.nyp.edu.sg/qa4u/qa4u_working/presenter/genPDF.php?eid=<?php echo $eid ?>&email=<?php echo $email ?>");
without forming static links is there a way to get the code to work ?