Siteme eklemiş olduğum formdaki bilgileri submit kontrolü ile başka sayfaya yönlendireceğim ve onu db'e kayıt yaptıracağım.
Kullandığım kodlar;
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,center,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v1.1
var autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;
if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
if (center && center != "" && popWidth > 0 && popHeight > 0) {
if (document.all || document.layers || document.getElementById) {
w = screen.availWidth; h = screen.availHeight;}
var leftPos = (w-popWidth)/2, topPos = (h-popHeight)/2;
features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
popupWindow = window.open(theURL,winName,features);
if (popupWindow.opener == null) popupWindow.opener = self;
if (document.all || document.layers || document.getElementById) {
if (borderless && borderless != "") {popupWindow.resizeTo(popWidth,popHeight); popupWindow.moveTo(leftPos, topPos);}
if (alwaysOnTop && alwaysOnTop != "") {
ontopIntervalHandle = popupWindow.setInterval("window.opener.popupWindow.focus();", 50);
popupWindow.document.body.onload = function() {popupWindow.setInterval("window.opener.popupWindow.focus();", 50);}; }
if (autoCloseTime && autoCloseTime > 0) {
popupWindow.document.body.onbeforeunload = function() {
if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
window.onbeforeunload = null; }
autoCloseTimeoutHandle = window.setTimeout("popupWindow.close()", autoCloseTime * 1000); }
window.onbeforeunload = function() {popupWindow.close();}; }
document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}
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_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' geçerli bir email adresi olmalı.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' gerekli.\n'; }
} if (errors) alert('Şu hatalar var:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script><form id="form1" name="form1" method="post" action="http://www.xxx.com/iletisim.php">
<table width="96%" border="0">
<tr>
<td width="27%" nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Ad Soyad </div></td>
<td width="3%" class="style25 style18 online_izle style28">:</td>
<td width="70%" class="style13"><input name="Ad" type="text" id="Ad" size="35" /></td>
</tr>
<tr>
<td nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">E-posta</div></td>
<td class="style25 style18 online_izle style28">:</td>
<td class="style13"><input name="Eposta" type="text" id="Eposta" size="35" /></td>
</tr>
<tr>
<td nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Firmanız</div></td>
<td class="style25 style18 online_izle style28">:</td>
<td class="style13"><input name="Firma" type="text" id="Firma" size="35" /></td>
</tr>
<tr>
<td nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Telefon</div></td>
<td class="style25 style18 online_izle style28">:</td>
<td class="style13"><input name="Telefon" type="text" id="Telefon" size="35" /></td>
</tr>
<tr>
<td nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Adresiniz</div></td>
<td class="style25 style18 online_izle style28">:</td>
<td class="style13"><input name="Adres" type="text" id="Adres" size="35" />
</td>
</tr>
<tr>
<td nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Konu</div></td>
<td class="style25 style18 online_izle style28">:</td>
<td class="style13"><input name="Konu" type="text" id="Konu" size="35" /></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap" class="online_izle style7 style18"><div align="right" class="style27">Mesajınız</div></td>
<td valign="top" class="style25 style18 online_izle style28">:</td>
<td class="style13"><textarea name="Mesaj" cols="40" rows="6" wrap="virtual" id="Mesaj"></textarea></td>
</tr>
<tr>
<td class="style19"><div align="right"></div></td>
<td class="style27"> </td>
<td class="style13"><input name="button" type="submit" onclick="MM_validateForm('Eposta','','RisEmail');return document.MM_returnValue" value="Gönder" />
<input type="reset" name="Submit2" value="Sil" /></td>
</tr>
</table>
</form>Yukarıdaki kodlarda görüldüğü üzere iletisim.html e giriliyor. Kişi bilgilerini vs dolduruyor. Gönder tuşuna bastıktan sonra http://www.xxx.com/iletisim.php yani iletisim.php e yönlendirdim. Fakat iletisim.php de burdaki bilgileri db e kayıt altına almam gerekli veya mail olarak bana gelmesi gerekiyor. Aslında talibim mail olarak gelmesinden yana fakat hangisi olursa kabul ederim.
Bu form u submit ile nasıl mail ime tüm bilgiler ile birlikte gönderebilirim.
Şimdiden teşekkür ederim.