Link wil niet openen in nieuw venster vanuit php

Status
Niet open voor verdere reacties.
Code:
<?php
//CAPTCHA***
session_start();
$captcha_error_message="";
$captcha_var="";
//Has the Action variable been submitted?
if(isset($_POST["verstuur"])){
//store captcha field value
if(isset($_POST['captcha'])){
$captcha_var=$_POST['captcha'];
}else if(isset($_GET['captcha'])){
$captcha_var=$_GET['captcha'];
}
$captcha_var=strtoupper($captcha_var);
//Check for failure:
//1. Is there $_SESSION['captcha']?
//2. Is $_SESSION['captcha'] blank?
//3. Is captcha string blank (it is by deafault)?
//4. Is there a match?
if(!isset($_SESSION['captcha']) || $_SESSION['captcha']=="" || $captcha_var=="" || (isset($_SESSION['captcha']) && md5($captcha_var)!=$_SESSION['captcha'])){
unset($_POST["verstuur"]);
$captcha_error_message="<div class=\"captcha_error_message\">De verificatiecode is onjuist.</div><script>function setCaptchaFocus(){var c=document.getElementById('captcha');c.scrollIntoView(true);c.select()};function addEvt(){if (window.addEventListener){window.addEventListener('load',setCaptchaFocus,null);return true}else if(window.attachEvent){return window.attachEvent('onload',setCaptchaFocus)}}; addEvt();</script>";
}
}
function makeCaptcha($im,$len,$t1,$t2,$t3,$b1,$b2,$b3,$error_message){
echo "<input name=\"captcha\" type=\"text\" autocomplete=\"off\" id=\"captcha\" /><br /><img onclick=\"rfr='&'+(new Date()).getTime();this.src+=rfr\" style=\"cursor:pointer\" src=\"captcha.php?image_file=".$im."&len=".$len."&t1=".$t1."&t2=".$t2."&t3=".$t3."&b1=".$b1."&b2=".$b2."&b3=".$b3."\" />".$error_message;
}


//Linecraft PHP Form mail v.1.2.0
if(isset($_POST["verstuur"])){
	$mail_form="[object FormElt]";
	$exception_fields=array("captcha","verstuur","wis");
	$to="info@decorator.nl";
	$from=$_POST['Emailadres'];
	$cc="";
	$bcc="";
	$host="";
	$username="";
	$password="";
	$subject="Contactformulier";
	$message_header="";
	$message_footer="";
	$message_body="";
	$format_html="\r\nContent-type: text/plain; charset=utf-8";
	$html="";
	$success_page="succes.php";
	$error_page="failure.php";
	$o_t="";
	$c_t="";
	$br="\n";
	//If HTML
	if($html=="1"){
		$o_t="<b>";
		$c_t="</b>";
		$br="<br>";
		$format_html="\r\nContent-type: text/html; charset=utf-8";
	}
	foreach($_POST as $fieldName => $value){
		if(!in_array($fieldName,$exception_fields)){
			$fieldName=str_replace("_"," ",$fieldName);
			$message_body=$message_body.$o_t.$fieldName.$c_t.": ".$value.$br;
		}
	}
	$message=$message_header.$br.$message_body.$br.$message_footer;
	@include_once "Mail.php";
	@include_once("Mail/mime.php");
	if(!class_exists('Mail') || !class_exists('Mail_mime')){
		$headers="From:".$from.$format_html;
		$headers.=($cc!="")?("\r\nCc: " . $cc):"";
		$headers.=($bcc!="")?("\r\nBcc: " . $bcc):"";
		if(mail($to, stripslashes($subject), stripslashes($message),$headers)){
			if($success_page!=""){
				header("Location:".$success_page);
			}
		}else{
			if($error_page!=""){
				header("Location:".$error_page);
			}
		}
	}else{
		if($cc!=""){$to.=", ".$cc;}
		if($bcc!=""){$to.=", ".$bcc;}
		if($host!="" && $username!="" && $password!=""){
			$contructor = Mail::factory('smtp',array ('host' => $host,'auth' => true,'username' => $username,'password' => $password));
		}else{
			$contructor = Mail::factory('mail');
		}
		$headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
		if($cc!=""){$headers['Cc']=$cc;}
		if($html=="1"){
			$mime = new Mail_mime("\n");
			$mime->setHTMLBody($message);
			$message = $mime->get();
			$headers = $mime->headers($headers);
		}
		$mail = $contructor->send($to, $headers, $message);

		if (PEAR::isError($mail)){
			if($error_page!=""){
				header("Location:".$error_page);
			}
		}else{
			if($success_page!=""){
				header("Location:".$success_page);
			}			
		}
	}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>DECORATOR - CONTACT</title>
<style type="text/css">
<!--
body {
	margin: 0;
	padding: 0;
	color: #006;
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
	font-size: 10pt;
	line-height: 1.2;
}

/* ~~ this fixed width container surrounds all other elements ~~ */
.container {
	width: 1009px;
	background: #FFF; /* the auto value on the sides, coupled with the width, centers the layout */
	height: 768px;
	margin-top: 0;
	margin-right: auto;
	margin-bottom: 0;
	margin-left: auto;
}

/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
	padding: 0;
	margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
	padding-right: 0px;
	padding-left: 0px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
	margin-top: 0;
	padding-top: 0px;
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
	border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
	color: #42413C;
	text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
	color: #6E6C64;
	text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
	text-decoration: none;
}

/* ~~ This is the layout information. ~~ 

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

*/
.content {
	height: 556px;
	width: 640px;
	padding-top: 0px;
	padding-right: 0;
	padding-bottom: 0px;
	padding-left: 0;
	position: absolute;
}

/* ~~ miscellaneous float/clear classes ~~ */
.fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
	float: left;
	margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */
	clear:both;
	height:0;
	font-size: 1px;
	line-height: 0px;
}
.container #contact {
	float: left;
	margin-left: 14px;
}
.container #contact_picture {
	float: left;
	margin-right: 30px;
	margin-left: 14px;
}
.captcha_error_message {
	color: #CCC;
}
-->
</style>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
</head>

<body onload="MM_preloadImages('images/headers/home button over.jpg','images/headers/decoratief schilderwerk button over.jpg','images/headers/objecten &amp; ornamenten button over.jpg','images/headers/schaalmodellen button over.jpg','images/headers/bedrijfsprofiel button over.jpg','images/headers/contact button up.jpg','images/headers/twitter button over.jpg','images/footers/footer disclaimer over.jpg')">

<div class="container"><img src="images/headers/header decorator.jpg" width="1009" height="137" alt="decorator header" /><img src="images/stripe.jpg" width="1009" height="1" alt="stripe 1" /><a href="home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home h','','images/headers/home button over.jpg',1)"><img src="images/headers/home button up.jpg" name="home h" width="62" height="25" border="0" id="home h" /></a><a href="decoratief schilderwerk.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('decoratief schilderwerk h','','images/headers/decoratief schilderwerk button over.jpg',1)"><img src="images/headers/decoratief schilderwerk button up.jpg" name="decoratief schilderwerk h" width="187" height="25" border="0" id="decoratief schilderwerk h" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('objecten &amp; ornamenten h','','images/headers/objecten &amp; ornamenten button over.jpg',1)"><img src="images/headers/objecten &amp; ornamenten button up.jpg" name="objecten &amp; ornamenten h" width="180" height="25" border="0" id="objecten &amp; ornamenten h" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('schaalmodellen h','','images/headers/schaalmodellen button over.jpg',1)"><img src="images/headers/schaalmodellen button up.jpg" name="schaalmodellen h" width="135" height="25" border="0" id="schaalmodellen h" /></a><a href="bedrijfsprofiel.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('bedrijfsprofiel h','','images/headers/bedrijfsprofiel button over.jpg',1)"><img src="images/headers/bedrijfsprofiel button up.jpg" name="bedrijfsprofiel h" width="122" height="25" border="0" id="bedrijfsprofiel h" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact h rev','','images/headers/contact button up.jpg',1)"><img src="images/headers/contact button over.jpg" width="99" height="25" alt="contact h" /><img src="images/headers/space button.jpg" width="164" height="25" alt="space h" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('twitter h','','images/headers/twitter button over.jpg',1)"><img src="images/headers/twitter button up.jpg" name="twitter h" width="60" height="25" border="0" id="twitter h" onclick="MM_openBrWindow('https://twitter.com/#!/I_am_decorator','','')" /></a><img src="images/stripe.jpg" width="1009" height="1" alt="stripe 2" /><img src="images/space width.jpg" width="1009" height="14" alt="space width" /><img src="images/content contact.jpg" alt="contact picture" name="contact_picture" width="320" height="556" id="contact_picture" />
<form action="" method="post" name="contact" id="contact">
      <p>
        <label for="Naam">Naam:<br />
        </label>
      <span id="sprytextfield1">
          <label for="Naam"></label>
          <input type="text" name="Naam" id="Naam" value="<?php echo $_POST['Naam'];?>"/>
  <span class="textfieldRequiredMsg">Er is geen naam ingevuld</span><span class="textfieldInvalidFormatMsg">Er is geen naam ingevuld.</span></span> </p>
      <p>
        <label for="Emailadres">Uw emailadres: <br />
        </label>
      <span id="sprytextfield2">
          <label for="Emailadres"></label>
          <input type="text" name="Emailadres" id="Emailadres" value="<?php echo $_POST['Emailadres'];?>"/>
  <span class="textfieldRequiredMsg">Onjuist emailadres</span><span class="textfieldInvalidFormatMsg">Onjuist emailadres.</span></span> </p>
      <p>
        <label for="Onderwerp">Onderwerp:<br />
        </label>
        <span id="sprytextfield3">
          <label for="Onderwerp"></label>
          <input type="text" name="Onderwerp" id="Onderwerp" value="<?php echo $_POST['Onderwerp'];?>"/>
  <span class="textfieldRequiredMsg">Er is geen onderwerp ingevuld</span><span class="textfieldInvalidFormatMsg">Er is geen onderwerp ingevuld.</span></span></p>
      <p>
   <label for="Bericht">Uw bericht:<br />
        </label>
   <span id="sprytextarea1">
   <label for="bericht"></label>
   <textarea name="bericht" id="bericht" cols="60" rows="5"><?php echo $_POST['Bericht'];?></textarea>
   <span class="textareaRequiredMsg">Er is geen bericht ingevuld</span></span>   <br />
      </p>
<p>
Type de verificatiecode na:
  <?php makeCaptcha("captcha.png","7","153","0","102","233","235","235",$captcha_error_message);?>
</p>
<p>&nbsp;      </p>
<p>
  <input type="submit" name="verstuur" id="verstuur" value="Verstuur" />
  <input type="reset" name="wis" id="wis" value="Wis" />
</p>
<p>&nbsp;</p>
<p>Susanne van der Steen</p>
<p>Dorshout 32</p>
<p>5462 GM Veghel</p>
<p>06 - 20 444 721</p>
</form>
    <p>&nbsp;</p>
    <h1>&nbsp;</h1>
  <img src="images/space width.jpg" width="1009" height="14" alt="space width" /><img src="images/stripe.jpg" width="1009" height="1" alt="stripe 3" /><a href="disclaimer.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('disclaimer f','','images/footers/footer disclaimer over.jpg',1)"><img src="images/footers/footer disclaimer up.jpg" name="disclaimer f" width="63" height="19" border="0" id="disclaimer f" /><img src="images/footers/space footer.jpg" width="946" height="19" alt="space f" /></a>
<!-- end .container --></div>
<ol>
  <li></li>
</ol>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1");
</script>
</body>
</html>
 
Laatst bewerkt:
waarom gebruik je geen "<a href></a>", op de normale link manier laten we maar zeggen?
 
ik ben nog vrij nieuw met website en codes, dus misschien zeg ik wel iets doms: maar ik wil de link laten openen in een nieuw window.
 
<a href="linkje" target="_blank">Tekst van de link</a>
Door target="_blank" aan een link toe te voegen zal de site in een nieuw venster/tab openen.

Overigens, als je grote lappen code op het forum zet kun je die beter tussen [*code] [/*code] of [*PHP][/*PHP] (*verwijderen) zetten, dat maakt het een stuk leesbaarder.
 
Laatst bewerkt:
<A HREF="nieuwVenster.php" TARGET="_blank">link hier!</A>

(naarling was sneller!)
 
Laatst bewerkt:
Super!!! Dank jullie voor de hulp. En ook voor de "laptekst" tip, ik heb het meteen veranderd.
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan