willfair Posted February 7, 2008 Share Posted February 7, 2008 Sorry to bug you all but I am still kind of green with PHP. I have a script that runs to update a SQL DB when a form is filled out. Right now I do a redirect at the end of the script to another page to take a person out of rotation for work assignment. What I would prefer to do is do that redirect in a popup and do a auto refresh on the page where the form is contained as it runs another popup that tells me when I need to put people back in rotation for work assignment. I know that was kind of wordy and probably full of grammatical mistakes. Here is my script <?php $tech=$_POST['tech']; $time1=$_POST['time1']; $time2=$_POST['time2']; //$date=mktime(date("m"),date("d"),date("Y")); $newstring=explode("- ",$tech); $newtech="$newstring[0]"; $enum="$newstring[1]"; $reason=$_POST['reason']; $lead=$_POST['lead']; $link="http://iacedweb04/GEAR/GTA_SOC/RepList2/rep_detail.asp?REP_ID="."$enum";; mysql_connect('$srv','$usr','$pwd'); mysql_select_db('lunch'); $query=("INSERT INTO turd VALUES (now(),'$newtech','$enum','$time1','$time2','$lead','$reason','yes')"); $result=mysql_query($query)or die( mysql_error() ) ; //echo "$query"; mysql_close(); //echo "<script //type='text/javascript'>window.open(popurl,'$link','width=500,height=500,location=0')</script>"; echo"<meta http-equiv=refresh content='0;url=$link'>"; ?> Want to change the refresh to point back to index.php and in the popup do the $link. Any help would be great. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
willfair Posted February 8, 2008 Author Share Posted February 8, 2008 I've searched thru here and see alot of stuff about java script popup, but most of them have the on click or on page load. I've tried some of them but cant seem to get them to work. I also should have mentioned I am totally new to Javascripts. Thanks again Quote Link to comment Share on other sites More sharing options...
willfair Posted February 11, 2008 Author Share Posted February 11, 2008 I have the popup actually poping up now, but it doesnt seems to know what my variable $link is. the address in the popup is coming up as http://socsupport.mcld.net/leads/php/$link Here is the new script. I moved the Java outside the php script <?php $tech=$_POST['tech']; $time1=$_POST['time1']; $time2=$_POST['time2']; //$date=mktime(date("m"),date("d"),date("Y")); $newstring=explode("- ",$tech); $newtech="$newstring[0]"; $enum="$newstring[1]"; $reason=$_POST['reason']; $lead=$_POST['lead']; $link="http://iacedweb04/GEAR/GTA_SOC/RepList2/rep_detail.asp?REP_ID="."$enum"; mysql_connect('localhost','*','*'); mysql_select_db('lunch'); $query=("INSERT INTO turd VALUES (now(),'$newtech','$enum','$time1','$time2','$lead','$reason','yes')"); $result=mysql_query($query)or die( mysql_error() ) ; //echo "$query"; mysql_close(); //echo "<script //echo"<meta http-equiv=refresh content=0;url=$link' target='TOP'>"; echo"<meta http-equiv=refresh content='0;url=../luncher.php'>"; ?> <SCRIPT language="JavaScript1.2"> function poponload() { testwindow= window.open ("$link", "mywindow", "location=1,status=1,scrollbars=1,width=500,height=300"); testwindow.moveTo(0,0); } </SCRIPT> <body onload='javascript: poponload()' bgcolor='#FFFFFF' background text='#000000' link='#0000FF' vlink='#0000FF' alink='#0000FF'> any Idea how i can get it to use the $link Thanks in advance Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted February 11, 2008 Share Posted February 11, 2008 <SCRIPT language="JavaScript1.2"> function poponload() { testwindow= window.open ("<?php echo $link; ?>", "mywindow", "location=1,status=1,scrollbars=1,width=500,height=300"); testwindow.moveTo(0,0); } Quote Link to comment Share on other sites More sharing options...
willfair Posted February 11, 2008 Author Share Posted February 11, 2008 that worked great Thanks for the help Quote Link to comment 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.