[ Príspevkov: 4 ] 
AutorSpráva
Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 12.01.07
Prihlásený: 16.02.12
Príspevky: 21
Témy: 9 | 9
NapísalOffline : 20.11.2007 17:25 | Postovy formular

potreboval by som html kod na postovy folmular aby priamo odoslalo


Offline

Čestný člen
Čestný člen
Postovy formular

Registrovaný: 17.10.06
Prihlásený: 08.01.11
Príspevky: 1752
Témy: 17 | 17
NapísalOffline : 20.11.2007 17:38 | Postovy formular

takych tu uz bolo. hladaj


_________________
A Real Programmer might or might not know his wife's name. He does, however, know the entire ASCII code table.
Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 21.06.07
Prihlásený: 06.05.13
Príspevky: 421
Témy: 4 | 4
NapísalOffline : 20.11.2007 19:16 | Postovy formular

<?php
$komu = "prijemca@abc.com";
$predmet = "Ahoj";
$text = "ako sa mas?";
mail($komu, $predmet, $text);
?>


Offline

Užívateľ
Užívateľ
Obrázok užívateľa

Registrovaný: 09.02.07
Prihlásený: 26.01.15
Príspevky: 257
Témy: 20 | 20
NapísalOffline : 21.11.2007 11:38 | Postovy formular

Dufam ze pomoze:

Formular obsahuje polia:

-> meno
-> priezvisko
-> email
-> potvrd email
-> predmet
-> sprava

Chcelo by to odladit, doplnit hlavicku ku odosielaniu emailu, pripradne pouzit napr. phpmailer-a...
Ja pri inputoch pouzivam triedu inputData, takze si tie inputy mozes potom pomocou tohto nastylizovat, takisto inputButton, ako aj cely FIELDSET...
Myslim si ale, ze ako zaciatocny point by ti to mohlo pomoct...

Kód:
<?php
// def funkcii pouzitych v skripte
// validacia mena
function verify_name($name)
  {
  if (!eregi('^[[:alpha:]\.\' \-]{3,}$', $name)) return false;
  else return true;
  }
 
// email validacia
function valid_email($email)
   {
   if ((!ereg(".+\@.+\..+", $email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $email)))
      return false;
   else
      return true;
   }

// form submitted
if (isset($_POST['Submit']) && isset($_POST['act']) && ($_POST['act'] == "sendContactForm"))
   {
  // bezpecnostny bod
   $firstName = @strip_tags(@trim($_POST['firstName']));
   $surname = @strip_tags(@trim($_POST['surname']));
   $email = @strip_tags(@trim($_POST['email']));
   $confirmEmail = @strip_tags(@trim($_POST['confirmEmail']));
   $subject = @strip_tags(@trim($_POST['predmet']));
   $comments = @strip_tags(@trim($_POST['comments']));

  // validacia
   if (empty($firstName) || !verify_name($firstName) || empty($surname) || !verify_name($surname) || empty($email) || empty($confirmEmail) || (!valid_email($email)) || empty($comments) || empty($subject))
      {
      if (empty($firstName) || !verify_name($firstName)) $errorFirstName = true;
      if (empty($surname) || !verify_name($surname)) $errorSurname = true;
      if (empty($email) || (!valid_email($email))) $errorEmail = true;
      if (empty($confirmEmail)) $errorConfirmEmail = true;
      if (empty($comments)) $errorComments = true;
      if (empty($subject)) $errorSubject = true;
      $errorGeneral = true;
      }
  // kontroluej ci overil sopravne email v druhom poli
   elseif ($email != $confirmEmail)
    {
    $errorConfirmEmailMatch = "Your 'Email' does not match the 'Confirm Email'.";
    $errorGeneral = true;
    }
   else
      {
      // odosli email -> pouzijem kod od senton-a -> chcelo by to doplnit este hlavicku
      // ale odporucal by som napr. phpmailer
      $komu = "tvoj_email@abc.com";
    $predmet = $subject;
    $text  = "";
    $text .= "Od: ".$firstName. " ".$surname."\n";
    $text .= "Odosielatelov email: ".$email."\n\n";
    $text .= "Sprava:\n".$comments."\n";
    if (mail($komu, $predmet, $text)) print "Sprava bola uspesne odoslana...";
    else print "Sorry. Error pri odosielani. Prosim skus neskor.";
      }
?>

<form action="http://<?php print $_SERVER['SERVER_NAME']; ?>/contact-us.php" method="post" class="contactForm">
<input type="hidden" name="act" value="sendContactForm" />

<fieldset>
<legend>Contact us by email</legend>

<!-- meno -->
<p>
  <label for="firstName"<?php if ($errorFirstName) print " class=\"errorText\""; ?>>Meno *:</label>
  <input type="text" name="firstName" id="firstName" value="<?php if (isset($_POST['act'])) print htmlentities($_POST['firstName'], ENT_QUOTES, 'UTF-8'); ?>" class="inputData" size="30" maxlength="30" />
</p>

<!-- priezvisko -->
<p>
  <label for="surname"<?php if ($errorSurname) print " class=\"errorText\""; ?>>Priezvisko *:</label>
  <input type="text" name="surname" id="surname" value="<?php if (isset($_POST['act'])) print htmlentities($_POST['surname'], ENT_QUOTES, 'UTF-8'); ?>" class="inputData" size="50" maxlength="50" />
</p>

<!-- email -->
<p>
<?php         if (isset($errorConfirmEmailMatch)): ?>
  <span class="errorText"><?php print $errorConfirmEmailMatch; ?></span><br />
<?php         endif; ?>
  <label for="email"<?php if ($errorEmail) print " class=\"errorText\""; ?>>Email *:</label>
  <input type="text" name="email" id="email" value="<?php if (isset($_POST['act'])) print htmlentities($_POST['email'], ENT_QUOTES, 'UTF-8'); ?>" class="inputData" size="50" maxlength="50" />
</p>

<!-- potvrd email -->
<p>
  <label for="confirmEmail"<?php if ($errorConfirmEmail) print " class=\"errorText\""; ?>>Potvrd email *:</label>
  <input type="text" name="confirmEmail" id="confirmEmail" value="<?php if (isset($_POST['act'])) print htmlentities($_POST['confirmEmail'], ENT_QUOTES, 'UTF-8'); ?>" class="inputData" size="50" maxlength="50" />
</p>

<!-- predmet -->
<p>
  <label for="subject"<?php if ($errorSubject) print " class=\"errorText\""; ?>>Predmet *:</label>
  <input type="text" name="subject" id="subject" value="<?php if (isset($_POST['act'])) print htmlentities($_POST['subject'], ENT_QUOTES, 'UTF-8'); ?>" class="inputData" size="50" maxlength="70" />
</p>

<!-- sprava -->
<p>
  <label for="comments"<?php if ($errorComments == true) print " class=\"errorText\""; ?>>Sprava *:</label>
  <textarea name="comments" id="comments" rows="7" cols="45" class="inputData"><?php if (isset($_POST['act'])) print htmlentities($_POST['comments'], ENT_QUOTES, 'UTF-8'); ?></textarea>
</p>
</fieldset>

<span class="smallText"><b>* required fields</b></span>

<!-- submit -->
<p class="submit">
  <input type="submit" name="Submit" value="Send" class="inputButton" />
</p>
</form>



CEST


 [ Príspevkov: 4 ] 


Postovy formular



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

poštový klient

v Ostatné programy

0

431

02.04.2012 11:41

evagabova

V tomto fóre nie sú ďalšie neprečítané témy.

postovy klien v opere

v Sieťové a internetové programy

5

441

09.02.2009 19:23

mienkofax

V tomto fóre nie sú ďalšie neprečítané témy.

C# - ako skryť aktívny formulár a otvoriť druhý formulár

[ Choď na stránku:Choď na stránku: 1, 2, 3 ]

v Technológia .NET

67

2764

28.06.2013 22:08

walther

V tomto fóre nie sú ďalšie neprečítané témy.

wordpress kontaktný formulár a objednávkový formulár

v Redakčné systémy

1

1142

22.08.2016 10:26

hatto13

V tomto fóre nie sú ďalšie neprečítané témy.

Formulár

v PHP, ASP

8

470

28.07.2015 17:55

walther

V tomto fóre nie sú ďalšie neprečítané témy.

formular

v PHP, ASP

6

784

28.02.2008 21:05

Tominator

V tomto fóre nie sú ďalšie neprečítané témy.

Formular

v HTML, XHTML, XML, CSS

9

471

04.04.2015 14:11

erikzet

V tomto fóre nie sú ďalšie neprečítané témy.

formular

v PHP, ASP

4

620

21.09.2008 10:38

dessert

V tomto fóre nie sú ďalšie neprečítané témy.

Formulár

v PHP, ASP

11

905

27.02.2009 12:38

Pades

V tomto fóre nie sú ďalšie neprečítané témy.

formulár

v HTML, XHTML, XML, CSS

14

1126

27.05.2007 10:00

p360t

V tomto fóre nie sú ďalšie neprečítané témy.

formular

v HTML, XHTML, XML, CSS

10

782

03.08.2008 19:27

rooobertek

V tomto fóre nie sú ďalšie neprečítané témy.

Formulár

v PHP, ASP

23

1726

01.04.2007 10:02

p360t

V tomto fóre nie sú ďalšie neprečítané témy.

formular

v JavaScript, VBScript, Ajax

21

1392

03.11.2011 10:53

elo

V tomto fóre nie sú ďalšie neprečítané témy.

Formular

v JavaScript, VBScript, Ajax

17

1315

24.12.2008 19:58

Draex

V tomto fóre nie sú ďalšie neprečítané témy.

formular

v HTML, XHTML, XML, CSS

24

1069

08.01.2011 14:55

shaggy

V tomto fóre nie sú ďalšie neprečítané témy.

Formulár

v PHP, ASP

9

702

07.07.2012 20:39

Vojko



© 2005 - 2024 PCforum, edited by JanoF