how could i open a new window using javascript inside php that holds a value of a js variable? please help. thx
gerbz
0
Newbie Poster
Recommended Answers
Jump to PostI didn't understood much of what you said. But PHP cannot hold a JS var, PHP can only execute JS by writing it and JS can only execute PHP by a server request.
Is something like this you want?
<?php echo('<script type="text/string">window.open(....);</script>'); ?>
Jump to PostI think so. Maybe he wants to use the variable in PHP as well. I believe, you can concatenate the variable to the string in the echo in order to pass the variable value to the new window.
Jump to Postin new page you can use php variable in javascript following way
<?php . . . $query = mysql_query(" INSERT INTO reservation VALUES('','$fname','$email','$pnum','$numofperson','$numofroom','$roomtype','$cur_date','$time2','$date_value','$stay','pending','$tot2','$tot2','0') "); . . . ?> <html> <script lang='javascript' > function myfunction() { var firstnm="<?php echo $fname;?>"; alert(firstnm); } </script>
All 10 Replies
AleMonteiro
238
Can I pick my title?
Taywin
312
Posting Virtuoso
gerbz
0
Newbie Poster
urtrivedi
276
Nearly a Posting Virtuoso
gerbz
0
Newbie Poster
gerbz
0
Newbie Poster
urtrivedi
276
Nearly a Posting Virtuoso
gerbz
0
Newbie Poster
urtrivedi
276
Nearly a Posting Virtuoso
gerbz
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.