Problem sa kontakt formom, zna li neko u cemu je problem

Problem sa kontakt formom, zna li neko u cemu je problem

offline
  • rss 
  • Ugledni građanin
  • Pridružio: 10 Jul 2007
  • Poruke: 417

html kod:

<form action="form-send.php" method="post">
<table width="400" border="0" cellspacing="0" cellpadding="5">
<tr valign="top">
<td colspan="2"><div align="center"><span class="style9">You can Reservate your room or bed in Mostar here. </span></div></td>
<td colspan="2" rowspan="12">&nbsp;</td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">Full name:</span></div></td>
<td width="226"><input name="name" type="text" id="name"></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">Email: </span></div></td>
<td width="226"><p>
<input name="mail" type="text" id="mail">
</p> </td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">Telephone number</span>:</div></td>
<td width="226"><input name="phone" type="text" id="phone"></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">Your from: </span></div></td>
<td width="226"><input name="from" type="text" id="from"></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">Room needed: </span></div></td>
<td width="226"><select name="rooms" id="rooms">
<option selected>Pleas select
<option value="I_need_Single_room">I need Single room [12 &euro;]
<option value="I_need_Double_room">I need Double room [10 &euro;]
<option value="I_need_Twin_room">I need Twin room [10 &euro;]
<option value="I_need_Share_triple_room">I need Share triple room (3 or 4 bed) [9.90 &euro;]
<option value="I_need_Group_booking">I need Group booking [by the deal]
</select></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">How many rooms:</span></div></td>
<td width="226"><select name="howmuch" id="howmuch">
<option selected>Pleas select
<option value="One_room">one room
<option value="More_room">More room
</select></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">For how long:</span></div></td>
<td width="226"><select name="days" id="days">
<option selected>Pleas select
<option value="Only_one_day">Only one day
<option value="Two_days">Two days
<option value="Thre_days">Thre days
<option value="More_days">More days
</select></td>
</tr>
<tr valign="top">
<td width="152" class="style10"><div align="right"><span class="style5">message: </span></div></td>
<td><p>
<textarea name="message" cols="35" rows="4" id="comments">Pleas write your message</textarea>
</p> </td>
</tr>
<tr valign="top">
<td class="style5"><div align="right" class="style11">From date:</div></td>
<td class="style10"><select name="fromdate" id="fromdate">
<option selected>Date
<option value="From_01_date">01
<option value="From_02_date">02
<option value="From_03_date">03
<option value="From_04_date">04
<option value="From_05_date">05
<option value="From_06_date">06
<option value="From_07_date">07
<option value="From_08_date">08
<option value="From_09_date">09
<option value="From_10_date">10
<option value="From_11_date">11
<option value="From_12_date">12
<option value="From_13_date">13
<option value="From_14_date">14
<option value="From_15_date">15
<option value="From_16_date">16
<option value="From_17_date">17
<option value="From_18_date">18
<option value="From_19_date">19
<option value="From_20_date">20
<option value="From_21_date">21
<option value="From_22_date">22
<option value="From_23_date">23
<option value="From_24_date">24
<option value="From_25_date">25
<option value="From_26_date">26
<option value="From_27_date">27
<option value="From_28_date">28
<option value="From_29_date">29
<option value="From_30_date">30
<option value="From_31_date">31
</select>
<select name="frommonth" id="frommonth">
<option selected>Month
<option value="From_January">January
<option value="From_February">February
<option value="From_March">March
<option value="From_April">April
<option value="From_May">May
<option value="From_Juni">Juni
<option value="From_July">July
<option value="From_August">August
<option value="From_September">September
<option value="From_October">October
<option value="From_November">November
<option value="From_December">December
</select>
<select name="fromyear" id="fromyear">
<option selected>Year
<option value="From_2007">2007
<option value="From_2008">2008
</select></td>
</tr>
<tr valign="top">
<td class="style5"><div align="right" class="style11">To date: </div></td>
<td class="style10"><select name="todate" id="todate">
<option selected>Date
<option value="To_01_date">01
<option value="To_02_date">02
<option value="To_03_date">03
<option value="To_04_date">04
<option value="To_05_date">05
<option value="To_06_date">06
<option value="To_07_date">07
<option value="To_08_date">08
<option value="To_09_date">09
<option value="To_10_date">10
<option value="To_11_date">11
<option value="To_12_date">12
<option value="To_13_date">13
<option value="To_14_date">14
<option value="To_15_date">15
<option value="To_16_date">16
<option value="To_17_date">17
<option value="To_18_date">18
<option value="To_19_date">19
<option value="To_20_date">20
<option value="To_21_date">21
<option value="To_22_date">22
<option value="To_23_date">23
<option value="To_24_date">24
<option value="To_25_date">25
<option value="To_26_date">26
<option value="To_27_date">27
<option value="To_28_date">28
<option value="To_29_date">29
<option value="To_30_date">30
<option value="To_31_date">31
</select>
<select name="tomonth" id="tomonth">
<option selected>Month
<option value="To_January">January
<option value="To_February">February
<option value="To_March">March
<option value="To_April">April
<option value="To_May">May
<option value="To_Juni">Juni
<option value="To_July">July
<option value="To_August">August
<option value="To_September">September
<option value="To_October">October
<option value="To_November">November
<option value="To_December">December
</select>
<select name="toyear" id="toyear">
<option selected>Year
<option value="To_2007">2007
<option value="To_2008">2008
</select></td>
</tr>

<tr valign="top">
<td colspan="2"><span class="style10">* All the prices are writen in &euro;uros.<br>
* All the prices are calculated pro person.<br>
* All group reservating prices by the deal.<br>
* For every group reservation we have a discount.<br>
*
Price for sleeping, includes permission for using kitchen.<br>
* There is secured parking for you vehicles.</span></td>
</tr>

<tr>
<td colspan="4"><div align="center">
<div align="center">
<input type="submit" name="Submit" value="Send Reservation">
<input name="Reset" type="reset" id="Reset" value="Reset reservation">
</div>
</tr>
</table>
</form>

php kod:

<?
$fp = fopen("rezultat.txt", "a");
fwrite($fp, $_POST['name'] . "," .
$_POST['mail'] . "," .
$_POST['phone'] . "," .
$_POST['from'] . "," .
$_POST['rooms'] . "," .
$_POST['howmuch'] . "," .
$_POST['days'] . "," .
$_POST['message'] . "," .
$_POST['fromdate'] . "," .
$_POST['frommonth'] . "," .
$_POST['fromyear'] . "," .
$_POST['todate'] . "," .
$_POST['tomonth'] . "," .
$_POST['toyear'] . ",");
fclose($fp);

$recipient = "tvoj@email.com";
$subject = "REZERVACIJA !!!";
$forminfo =
($_POST['name'] . "\r" .
$_POST['mail'] . "\r" .
$_POST['phone'] . "\r" .
$_POST['from'] . "\r" .
$_POST['rooms'] . "\r" .
$_POST['howmuch'] . "\r" .
$_POST['days'] . "\r" .
$_POST['message'] . "\r" .
$_POST['fromdate'] . "\r" .
$_POST['frommonth'] . "\r" .
$_POST['fromyear'] . "\r" .
$_POST['todate'] . "\r" .
$_POST['tomonth'] . "\r" .
$_POST['toyear'] . "\r");
$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>succesfuly</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
body {
background-color: #F4F4F4;
}
-->
</style>
</head>

<body>
<table width="400" border="0" cellspacing="0" cellpadding="5">
<tr>
<td> <p align="center" class="style2">Thank you. You have successfully submitted Your reservation. Pleas wait for request by Tvoje ime.<br>
</p>
<p align="left" class="style2">Your information sended:<br>
<? echo nl2br($forminfo); ?></p>
<p align="center" class="style2">Click <a href="http://www.hostelmiran.com/frame2.html">here</a> to back on Tvoje Ime home page </p>

</tr>
</table>
<p align="center"></p>
</td>
</body>
</html>


i imam jos jedan php dokument zove se phpinfo i stoji:
<?php
phpinfo();
?>


uz to imam:

form-results.txt
i
rezultat.txt

sve sam zivo probo i nece, imali iko iskustva, sta da radim, naravno form-resluts.txt sam prebacio na 777 na ftp-u, i gore gdje pise tvoj@email.com je bio moj mail, ali ne stize, moze li mi neko reci u cemu je problem?


Molim da mi neko kaze posto mi je hitno.



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • PHP developer
  • Pridružio: 22 Mar 2006
  • Poruke: 3760
  • Gde živiš: 127.0.0.1

prvo, proveri SPAM (bulk, whatever) folder na serveru. Neki mail serveri znaju da mail poslat preko mail() funkcije tretiraju kao spam. Neki ga prebace u spam folder, a neki obrisu.

drugo, umesto "\r" stavi "\r\n" - to ti ne pravi problem (ovaj koji si ti opisao), ali ces shvatiti kad ti forma proradi i dobijes mail Smile

trece, posle
$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");

stavi

if (!formsend) { die('Oooops! Nesto je krenulo naopako'); }

da vidis da li ovo uopste salje formu Smile

cetvrto, VELIKA vecina free hostova ne dozvoljava mail() funkciju

peto, otvori rezultat.txt i pogledaj imas li ista u njemu (i on treba da bude chmod 777)

sesto, probaj ovako:
$headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $_POST['name'] . '<' . $_POST['mail'] . '>' . "\r\n"; $formsend = mail($recipient, $subject, $forminfo, $headers); if (!formsend) { die('Oooops! Nesto je krenulo naopako'); }

i sedmo, kada kacis kod (html ili php) na mycity, koristi tagove predvidjene za to Smile

Dopuna: 14 Okt 2007 4:54

i da, nevezano za tvoj problem koji si opisao... ispravi gramaticke greske... npr sended - send je nepravilan glagol i u proslom vremenu glasi sent, a imas i jos neke grescice Smile obrati paznju...



offline
  • rss 
  • Ugledni građanin
  • Pridružio: 10 Jul 2007
  • Poruke: 417

pa gdje sve to da ugradim u ovaj kod, i sta sve da izbrisem?

offline
  • PHP developer
  • Pridružio: 22 Mar 2006
  • Poruke: 3760
  • Gde živiš: 127.0.0.1

iskreno, ova forma nema veze sa zivotom, toliko je na brzinu napisana da je to cudo... tako se to ne radi...

recimo da nigde nemas proveru da li je IJEDNO polje popunjeno, u stvari, cak nemas ni proveru da li je uopste kliknuto na polje submit...

za pocetak, umesto

$forminfo = ($_POST['name'] . "\r" . $_POST['mail'] . "\r" . $_POST['phone'] . "\r" . $_POST['from'] . "\r" . $_POST['rooms'] . "\r" . $_POST['howmuch'] . "\r" . $_POST['days'] . "\r" . $_POST['message'] . "\r" . $_POST['fromdate'] . "\r" . $_POST['frommonth'] . "\r" . $_POST['fromyear'] . "\r" . $_POST['todate'] . "\r" . $_POST['tomonth'] . "\r" . $_POST['toyear'] . "\r"); $formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");}

stavi
$forminfo = ($_POST['name'] . "\r\n" . $_POST['mail'] . "\r\n" . $_POST['phone'] . "\r\n" . $_POST['from'] . "\r\n" . $_POST['rooms'] . "\r\n" . $_POST['howmuch'] . "\r\n" . $_POST['days'] . "\r\n" . $_POST['message'] . "\r\n" . $_POST['fromdate'] . "\r\n" . $_POST['frommonth'] . "\r\n" . $_POST['fromyear'] . "\r\n" . $_POST['todate'] . "\r\n" . $_POST['tomonth'] . "\r\n" . $_POST['toyear'] . "\r\n"); $headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $_POST['name'] . '<' . $_POST['mail'] . '>' . "\r\n"; $formsend = mail($recipient, $subject, $forminfo, $headers); if (!formsend) { die('Oooops! Nesto je krenulo naopako');

i chmod 777 rezultat.txt, probaj da li radi skripta, sta izbacuje kad je pokrenes i da li nesto upisuje u rezultat.xt

Ko je trenutno na forumu
 

Ukupno su 1053 korisnika na forumu :: 35 registrovanih, 7 sakrivenih i 1011 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: _Rade, A.R.Chafee.Jr., acatomic, anta, bojankrstc, bojcistv, BratSrpska, brundo65, cavatina, ccoogg123, Darko8, Denaya, dora, dule10savic, kolle.the.kid, kunktator, KUZMAR, kybonacci, laki_bb, loon123, Mi lao shu, milos97, mnn2, MrNo, nazgul75, Posmatrac77OKB, RED4G-304, Reddot, savaskytec, Silvertooth, Snorks, vaso1, Viktor Petrenko, VP6919, šumar bk2