Jump to content

Java Script popup window at the end of a PHP script, Possible?


willfair

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.