← Desenvolvimento

sistema de formulario

Lida 5821 vezes

Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Pessoal preciso de um sistema de formulario, que quando alguem se inscreva envie um email com formulario para o meu email

Tinha um mas de repente deixou de funcionar  :(

Edited:
Fiz o download do PHPeasy-formv2 até é fixe so que tem um problema, quando envia o email para nós nao tem o nome dos campos atraz, aparece so as respostas dos users...
sera que e possivel colocar as perguntas atras?
o codigo é este:

Código: [Seleccione]
<!-- PHP easy-form -->
<?
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Copyright (C) 2004-2005 SunFrogServices.com. All rights reserved.

   PHPeasy-form version 2.0
   Released 2005-05-16

   This file is part of PHPeasy-form.

   PHPeasy-form is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

    PHPeasy-form is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PHPeasy-form; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Contact SunFrogServices.com at:
http://www.SunFrogServices.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
// write form results to file

$fp = fopen("form-results.txt", "a");
fwrite($fp, $_POST['name'] . "," .
$_POST['address'] . "," .
$_POST['city'] . "," .
$_POST['state'] . "," .
$_POST['zip'] . "," .
$_POST['phone'] . "," .
$_POST['email'] . "," .
$_POST['comments'] . "," .
date("M-d-Y") . "\n");
fclose($fp);

// send form results through email
$recipient = "user@foo.com";
$subject = "Web Form Results";
$forminfo =
($_POST['name'] . "\r" .
$_POST['address'] . "\r" .
$_POST['city'] . "\r" .
$_POST['state']  . "\r" .
$_POST['zip']  . "\r" .
$_POST['phone']  . "\r" .
$_POST['email'] . "\r" .
$_POST['comments'] . "\r\n" .
date("M-d-Y") . "\r\n\n");

$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email");
?>
<!-- end PHPeasy-form -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td> <p align="left">Thank you. You have successfully submitted the following information:</p>
<p><? echo nl2br($forminfo); ?></p>
  </tr>
</table>
<p align="center"><font size="1">PHPeasy-form written by <a href="http://www.sunfrogservices.com" target="_blank">SunFrogServices.com</a></font></p></td>
</body>
</html>
Offline

fpware 
Fundador
Mensagens 15318 Gostos 7
Troféus totais: 38
Trófeus: (Ver todos)
Linux User Mobile User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5

morpheus, podes dar uma ajudinha aqui?
Offline

MiguelTavares 
Membro
Mensagens 3871 Gostos 0
Troféus totais: 33
Trófeus: (Ver todos)
Avatar Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4

Exprimenta mudar isto:
Código: [Seleccione]
$fp = fopen("form-results.txt", "a");
fwrite($fp, $_POST['name'] . "," .
         $_POST['address'] . "," .
         $_POST['city'] . "," .
         $_POST['state'] . "," .
         $_POST['zip'] . "," .
         $_POST['phone'] . "," .
         $_POST['email'] . "," .
         $_POST['comments'] . "," .
         date("M-d-Y") . "\n");
fclose($fp);



para isto:
Código: [Seleccione]
$fp = fopen("form-results.txt", "a");
fwrite($fp, "Nome: " . $_POST['name'] . "," .
         "Morada: " . $_POST['address'] . "," .
         "Cidade: " . $_POST['city'] . "," .
         "Estado: " . $_POST['state'] . "," .
         "CodigoPostal: " . $_POST['zip'] . "," .
         "NumTelefone: " . $_POST['phone'] . "," .
         "Email: " . $_POST['email'] . "," .
         "Comentarios: " . $_POST['comments'] . "," .
         "Data: " . date("M-d-Y") . "\n");
fclose($fp);


Depois metes ao teu jeito. Penso que assim irá funcionar. ;)
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Thanks MeNz, vou ver isso amanha..
Agora vou me deitar, tou um bocado cansado :S

Boa noite  :+trafego:

Até amanha
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Funcionou na perfeição  :obrigado:
mas uma correção o local não era esse, mas sim
Código: [Seleccione]
// send form results through email
$recipient = "user@foo.com";
$subject = "Web Form Results";
$forminfo =
($_POST['name'] . "\r" .
$_POST['address'] . "\r" .
$_POST['city'] . "\r" .
$_POST['state']  . "\r" .
$_POST['zip']  . "\r" .
$_POST['phone']  . "\r" .
$_POST['email'] . "\r" .
$_POST['comments'] . "\r\n" .
date("M-d-Y") . "\r\n\n");
Offline

morpheus 
Membro
Mensagens 1199 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 1000 Posts

oooopppss... cheguei tarde... sorry ;)

também, vocês estão aqui às 5 da matina? já ouviram falar de uma inovação tecnológica chamada... cama? :lol:
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Citação de: "morpheus"
oooopppss... cheguei tarde... sorry ;)

também, vocês estão aqui às 5 da matina? já ouviram falar de uma inovação tecnológica chamada... cama? :lol:

:superlol:
Já agora morpheus, eu reparei que neste script nao obriga a preencher todos os campos, será que é possivel colocar campos obrigatórios?
Gostava de colocar o nome, a morada e o email como obrigatório
Offline

fpware 
Fundador
Mensagens 15318 Gostos 7
Troféus totais: 38
Trófeus: (Ver todos)
Linux User Mobile User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5

Obrigado MeNZ! :D
Offline

morpheus 
Membro
Mensagens 1199 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 1000 Posts

para isso tens que definir como obrigatório nos campos do próprio formulário, na página anterior a esta. :wink:
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

humm como é que eu faço isso ?
Offline

morpheus 
Membro
Mensagens 1199 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 1000 Posts

Se usas o dreamweaver, ao editar, podes definir o campo como obrigatório nas propriedades.
Offline

MiguelTavares 
Membro
Mensagens 3871 Gostos 0
Troféus totais: 33
Trófeus: (Ver todos)
Avatar Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4

Citação de: "Freedoom"
Funcionou na perfeição  :obrigado:
mas uma correção o local não era esse, mas sim
Código: [Seleccione]
// send form results through email
$recipient = "user@foo.com";
$subject = "Web Form Results";
$forminfo =
($_POST['name'] . "\r" .
$_POST['address'] . "\r" .
$_POST['city'] . "\r" .
$_POST['state']  . "\r" .
$_POST['zip']  . "\r" .
$_POST['phone']  . "\r" .
$_POST['email'] . "\r" .
$_POST['comments'] . "\r\n" .
date("M-d-Y") . "\r\n\n");


Oopssss. epá... foi do cansaço :P
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

ya na boa, mas eu percebi  :D
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Citação de: "morpheus"
Se usas o dreamweaver, ao editar, podes definir o campo como obrigatório nas propriedades.

humm vou ver isso  :)
Offline

Freedoom 
Membro
Mensagens 723 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

sinceramente nao estou a ver onde posso colocar como obrigatorio..
http://img287.imageshack.us/my.php?image=semttulo2ir.png
Quando vou as opçoes do campo aparece me isso só