[ 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

512

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é programy

5

510

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 Backend

67

3076

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 CMS

1

1302

22.08.2016 10:26

hatto13

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

formular

v Frontend

5

777

17.02.2009 0:50

Blackshadow

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

formular

v Backend

3

588

31.07.2011 15:09

kudzo3

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

formulár

v Frontend

6

670

27.03.2013 8:19

Achelan

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

Formular

v Frontend

14

928

03.05.2008 19:31

Svolo

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

FORMULAR

v Ponuka a dopyt práce

3

1897

30.05.2006 6:51

jakub023

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

formulár

v Backend

1

636

07.06.2009 15:44

Ďuri

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

formular

v Frontend

1

650

02.02.2011 17:13

Ďuri

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

Formulár

v Backend

0

488

24.09.2012 15:35

e-shark

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

Formular

v Ostatné

0

446

08.03.2016 19:23

matej71

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

Formular

v Backend

1

513

09.07.2012 20:31

killer

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

Formulár

v Backend

8

568

28.07.2015 17:55

walther

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

formular

v Backend

6

908

28.02.2008 21:05

Tominator



© 2005 - 2026 PCforum, edited by JanoF