Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

Reply
 
Thread Tools Display Modes
Old October 23rd, 2002, 20:56   #1
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
Unhappy [need help] contact Formular in PHP

Hi

I have writen a contact php script but it don't work correct

her is the script


PHP Code:
<?php
$rootdir
="../";
include(
"../layout/header.inc");
?>
<link rel="stylesheet" href="../styles/styles.css" type="text/css">

    
     <?php
     
if($Submit){
       if(
strlen($name)<3){
       
$error_msg="Bitte geben Sie Ihren Namen an.<br>";
       }
       if(!
ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$",$email)){
       
$error_msg.="Bitte geben Sie eine gültige eMail-Adresse an.<br>";
       }
       if(
strlen($anfrage)<3){
       
$error_msg.="Bitte geben Sie an, welche Anfrage Sie an uns richten möchten.<br>";
       }
       if(
$error_msg){
       
//Eines der Felder wurde nicht korrekt ausgefüllt
       
echo "Ihre Anfrage konnte aus folgenden Gründen leider nicht bearbeitet werden:<br><br>";
       echo 
$error_msg;
       echo 
"<br>Bitte klicken Sie auf <a href=Java Script:history.back(1)>zurück</a> und füllen Sie alle Felder aus.";
       }else{
       
//Alle Felder ausgefüllt - eMail generieren
       
$recipient="php@test.de";
       
$subject="Eine Anfrage aus dem Internet";
       
$header="From: " $email "\n";
       
$mail_body ="Das Anfrage-Formular wurde am " date("d.m.Y") . " um " date("H:i") . "h ausgeführt.\n";
       
$mail_body.="Folgende Werte wurden eingetragen:\n\n";
       
$mail_body.="Name: " $name "\n";
       
$mail_body.="eMail: " $email "\n\n";
       
$mail_body.="Anfrage:\n";
       
$mail_body.=$anfrage "\n\n ---- Ende der automatisch generierten eMail ----";
     
       
mail($recipient,$subject,$mail_body,$header);
          
       
//Formular ausgeführt - Meldung ausgeben
       
echo "Vielen Dank für Ihre Anfrage.";
       }
     }else{
     
//Formular noch nicht ausgeführt - Formular anzeigen
     
?>
     
      <h2>Benutzen Sie das folgende Formular, um Kontakt mit uns aufzunehmen:<br>
      </h2>
      <form action=<?php echo $PHP_SELF ?> method=POST>     
      <table width="500" border="0" cellspacing="2" cellpadding="2">
        <tr>
          <td width="183" class="kleiner">Geben Sie hier Ihren Namen an:</td>
          <td width="232">
            <input type="text" name="name" size="35">
          </td>
        </tr>
        <tr>
          <td width="183" class="kleiner">Geben Sie hier Ihre eMail-Adresse an:</td>
          <td width="232">
            <input type="text" name="email" size="35">
          </td>
        </tr>
        <tr>
          <td width="183" class="kleiner">Ihre Anfrage:</td>
          <td width="232">
            <textarea name="anfrage" cols="30" rows="3"></textarea>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <div align="center">
              <input type="submit" name="Submit" value="Abschicken">
            </div>
          </td>
        </tr>
      </table>
      </form>
      <?php
      
}
      
?>

<?php
//Zweiter Teil des Standardlayouts
include("../layout/footer.inc");
?>

when I whant test these script than I get a error msg

Quote:
Notice: Undefined variable: Submit in c:\wampp13a\htdocs\hp\hp_php\kontakt\index.php on line 9
and then I get the Formular

what must I do to define the variable Submit :confused:

is these script correct or are there mistakes???
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old October 23rd, 2002, 21:26   #2
_E_
Lurking
 
Join Date: Aug 2002
Location: Gone
Posts: 9,354
I am running out of time, so i cant look at every single line you wrote. but just to make sure, i debugged the whole thing with Microsoft Script Editor and it doesnt seem wrong to me. Anyhow I think you got somewhere wrong in line number 9, but i cannot allocate the error either......
__________________

-= Moral cowardice that keeps us from speaking our minds is as dangerous to this country as irresponsible talk. The right way is not always =-
the popular and easy way. Standing for right when it is unpopular is a true test of moral character.
Margaret C. Smith
_E_ is offline   Reply With Quote
Old October 23rd, 2002, 21:30   #3
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
yes i know that the mistake is in line 9 but how can I define these Variable ???
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 23rd, 2002, 21:36   #4
_E_
Lurking
 
Join Date: Aug 2002
Location: Gone
Posts: 9,354
I cant say why this is happening isnce everytime i test it, i dont get any error message ( i know, thats really wierd) .
__________________

-= Moral cowardice that keeps us from speaking our minds is as dangerous to this country as irresponsible talk. The right way is not always =-
the popular and easy way. Standing for right when it is unpopular is a true test of moral character.
Margaret C. Smith
_E_ is offline   Reply With Quote
Old October 23rd, 2002, 21:40   #5
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
i will try to test these Script on an other server. I have testet the script only on my Local WAMP Server
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 23rd, 2002, 21:42   #6
Neojag
:: [ Sauron's Eye ] ::
 
Neojag's Avatar
 
Join Date: Apr 2001
Location: In the Land of Mordor, where the Shadows lie...
Posts: 3,258
hum, tested it on my local server, works ok (stripped the includes tough) :P
__________________
*sig removed. hosted on infected site*
Neojag is offline   Reply With Quote
Old October 23rd, 2002, 21:55   #7
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
So I have testet it on Tripod and it works Correct

So my server is ****

Neojag what server you are using on your PC????
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 24th, 2002, 00:12   #8
Neojag
:: [ Sauron's Eye ] ::
 
Neojag's Avatar
 
Join Date: Apr 2001
Location: In the Land of Mordor, where the Shadows lie...
Posts: 3,258
using OmniHTTPd atm
__________________
*sig removed. hosted on infected site*
Neojag is offline   Reply With Quote
Old October 24th, 2002, 07:32   #9
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
you are right
I have install OmniHTTPd and it works thank you
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 24th, 2002, 12:36   #10
Nezzar
NSBQ nut
 
Nezzar's Avatar
 
Join Date: Aug 2001
Location: .de
Posts: 1,208
Usually it shouldn't depend on which server you use but rather on the PHP configuration. Have you looked at the error_reporting-function in PHP?
__________________
Bred for its skills in magic
Nezzar is offline   Reply With Quote
Old October 24th, 2002, 13:05   #11
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
no i don't
but on omni httpd there are no errors in my script.

thank for your help.
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 24th, 2002, 13:35   #12
Mohd
.:: PHP King ::.
 
Mohd's Avatar
 
Join Date: Mar 2002
Location: Bahrain
Posts: 580
Re: [need help] contact Formular in PHP

Quote:
Originally posted by snowbear
Hi





when I whant test these script than I get a error msg



and then I get the Formular

what must I do to define the variable Submit :confused:

is these script correct or are there mistakes???
I know what is the problem

Because of the latest release of php


please check your php version if it is the latest one you will see this error (Happen to me)
Mohd is offline   Reply With Quote
Old October 24th, 2002, 13:51   #13
snowbear
Registered User
 
Join Date: Jan 2002
Location: Germany/Köln
Posts: 45
Yes I know when I' am using Omni httpd with an older version of PHP I got no errors

but in my WAMP is an new version of PHP and there I get these errors

these is the problem with the register_globels isn't it?

Nezzar has shown me to go round these problem
__________________
Sorry for my very bad English
snowbear is offline   Reply With Quote
Old October 24th, 2002, 15:23   #14
Nezzar
NSBQ nut
 
Nezzar's Avatar
 
Join Date: Aug 2001
Location: .de
Posts: 1,208
BTW, there is another workaround to this:
http://www.php.net/manual/en/functio...-variables.php
__________________
Bred for its skills in magic
Nezzar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 13:57.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.