I have a php variable obtained from a post:
<?php
$pdf_name = $_POST['pdf_name'];
echo $pdf_name;
?>
When I insert it into the flipbook script I get an error:
<script type="text/javascript">
$(document).ready(function () {
$("#read").flipBook({
//Layout Setting
pdfUrl:'uploads/pdf-gallery/<?php $pdf_name ?>',
lightBox:true,
...............
...............
............... etc.
});
})
</script>
This is the ERROR:
pdfUrl:'uploads/pdf-gallery/<br />
<b>Warning</b>: Undefined variable $pdf_name in <b>C:xampphtdocsmysitepdf-gallery.php</b> on line <b>81</b><br />
<br />
While if I insert this variable it works well and I get:
<?php
$pdf_name = 'tex-willer.pdf';
echo $pdf_name;
?>
<script type="text/javascript">
$(document).ready(function () {
$("#read").flipBook({
//Layout Setting
pdfUrl:'uploads/pdf-gallery/tex-willer.pdf',
lightBox:true,
........... etc
</script>
How can I eliminate the error from the first situation???
2
Answers
I inserted an alert and it works also in the first situation
you should try this, may be this issue concatenate the value of $pdf_name with the static string ‘upload/pdf-gallery/’