PDA

View Full Version : Implement pop-up in PHP


shift
03-17-2006, 03:41 PM
Hi,

I need some help please. I have a php file that i need to open a pop-up window.

I know i need to use js, i have the code but is still not workin :(

Can u help me please?

Here is the code:

-----------------------------------------------------------------

if(!empty($_POST['emailaddress']) && preg_match(":^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+[a-zA-Z]{2,6}\$:i" , $_POST['emailaddress']))
{
if(isset($_POST['submit']))
{
$dbc=mysql_connect("localhost",$GLOBALS['dbuser'],$GLOBALS['dbpass']);
if($dbc) {
if(!@mysql_select_db($GLOBALS['dbname'])) {
die('<p>Could not select the data base because:<b>'.mysql_error().'</b></c>');
}
} else{
die('<p>Could not connect to MySql because:<b>'.mysql_error().'</b></p>');
}

$sql="insert into welcomeemail values ('','".$_POST['emailaddress']."','".$_POST['fullname']."','".$_POST['location']."',NOW())";
if(@mysql_query($sql)){
echo "<script language=javascript>
window.open(\"fereastra\",\"fereastra\",\"top=0,left=0,height=200,width=200\")
fereastra.document.open()
fereastra.document.write(\"You have beed added\")
fereastra.document.close()
</script>";

}
else{
//print"<p>Could not add the entry because:<b>".mysql_error()."</b>.The query was $query.</p>";
}

mysql_close();
}
}


-----------------------------------