bnshiva Posted July 21, 2011 Share Posted July 21, 2011 Hey guys, I have got a piece of code.. I want the script(api) window.open ("http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=username&password=****&sendername=Vfup&mobileno=<?echo '.$f.' &message=<?php echo'.$message1.'?>" to be executed until while condition is satisfied, the problem is that when i use the php variables in the javascript, the php tag is closed after the first echo statement in th javascript, which is not desirable.. I need some help in the syntax so that the error is corrected. I would be glad to welcome alternative code, my requirement is to execute the api, until the while condition is satisfied without affecting the remaining code.. I would be pleased to provide more info on the code.. Here is the code <?php // Connects to your Database $std=$_POST['std']; $test_no=$_POST['test_no']; $sec=$_POST['sec']; echo "<h2> The Marksheet of class $std students of Test Number: $test_no</h2>"; echo "<h2> Section: $sec</h2>"; mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("sample_school") or die(mysql_error()); if($test_no==1) { $data1 = mysql_query("SELECT s.sid,name,sec ,t1_m1,t1_m2,t1_m3,t1_m4,t1_m5,t1_m6,f_phone,father_name,f_email FROM student as s NATURAL JOIN t1 WHERE class='$std' AND sec='$sec'") or die(mysql_error()); while($info = mysql_fetch_array( $data1 )) { $f="91$info[f_phone]"; $message="HI Mr, '$info[father_name] Below is the marksheet of your ward Sid:'$info[sid]', Name:'$info[name]' , Subject1: '$info[t1_m1]' Subject2:'$info[t1_m2]' Subject3: '$info[t1_m3]'Subject4: '$info[t1_m4]' Subject5: '$info[t1_m5]' Subject6: '$info[t1_m6]'To view detailed marks list, visit http://localhost/Vfup/admin_home.php "; $message1="'$info[name]' $info[sid] Marks of Test1 Lang1:'$info[t1_m1]',Lang2:'$info[t1_m2]',Lang3:'$info[t1_m3]',Maths:'$info[t1_m4]',Science:'$info[t1_m5]',Social:'$info[t1_m6]'"; //mail($f_email,'Marks Sheet',$message); echo"Email sent Successfully to '$info[father_name]'"; echo'<script language="javascript" type="text/javascript"> window.open ("http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=username&password=****&sendername=Vfup&mobileno=<?echo '.$f.' &message=<?php echo'.$message1.'?>","mywindow","menubar=1,resizable=1,width=350,height=250"); pausecomp("3000"); document.close(); function pausecomp(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); } </script> '; } } ..... ..... ?> Regards, Shivashankar Quote Link to comment https://forums.phpfreaks.com/topic/242535-executing-a-script/ Share on other sites More sharing options...
trq Posted July 21, 2011 Share Posted July 21, 2011 Looks like your calling echo within echo. Quote Link to comment https://forums.phpfreaks.com/topic/242535-executing-a-script/#findComment-1245591 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.