Results 1 to 2 of 2

Thread: Form - mail

  1. #1
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Form - mail

    I have a problem with a mailform. I probably overlooked some minor detail.
    In the php-script, the user is redirected to joinin2.html if the mail is send correct and to joinin3.html if something went wrong.

    While trying i am sent to joinin3.html all the time, but i can't see the problem.
    Here are the codes
    Code:
    <form method="post" action="leden.php">
    <table width="570" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100px"></td>
        <td width="100px"></td>
        <td width="70px"></td>
        <td width="300px"></td>
      </tr>
      <tr>
        <td align="right" id="maintext">Naam : </td>
        <td colspan="3">&nbsp;<input type="text" size="65" name="Naam" id="maintext"></td>
      </tr>
      <tr>
        <td align="right" id="maintext">Voornaam : </td>
        <td colspan="3">&nbsp;<input type="text" size="65" name="Voornaam" id="maintext"></td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" id="maintext">Adres : </td>
        <td colspan="3">&nbsp;<input type="text" size="65" name="Adres" id="maintext"></td>
      </tr>
      <tr>
        <td align="right" id="maintext">Nr. : </td>
        <td>&nbsp;<input type="text" size="10" name="Nr" id="maintext"></td>
        <td align="right" id="maintext">Postbus : </td>
        <td>&nbsp;<input type="text" size="10" name="PB" id="maintext"></td>
      </tr>
      <tr>
        <td align="right" id="maintext">Postcode : </td>
        <td>&nbsp;<input type="text" size="10" name="Postcode" id="maintext"></td>
        <td align="right" id="maintext">Gemeente : </td>
        <td>&nbsp;<input type="text" size="37" name="Gemeente" id="maintext"></td>
      </tr>
      <tr>
        <td align="right" id="maintext">Land : </td>
        <td colspan="3">&nbsp;<input type="text" size="30" name="Land" id="maintext"></td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" id="maintext">Geboortedatum :</td>
        <td colspan="3">&nbsp;<input type="text" size="30" name="GebDat" id="maintext"></td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" id="maintext">E-Mail : </td>
        <td colspan="3">&nbsp;<input type="text" size="65" name="Email" id="maintext"></td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" id="maintext">Maat T-shirt : </td>
        <td colspan="3">&nbsp;<select name="Maat" id="maintext">
    	<option value="XXS" id="maintext">XXS</option>
    	<option value="XS" id="maintext">XS</option>
    	<option value="S" id="maintext">S</option>
    	<option value="M" id="maintext">M</option>
    	<option value="L" id="maintext">L</option>
    	<option value="XL" id="maintext">XL</option>
    	<option value="XXL" id="maintext">XXL</option>
    	</select></td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" id="maintext" valign="top">Lidgeld : </td>
        <td colspan="3" id="maintext" valign="top">
    	<input type="radio" name="Lid" value="15euro">&euro;15<br>
    	<input type="radio" name="Lid" value="10euro">&euro;10 - spelers Sporting Neerpelt en jongeren onder de 16 jaar<br>
    	</td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td colspan="3"><input type="submit" name="Submit" value="Verzenden" id="but"></td>
      </tr>
    </table>
    </form>
    leden.php
    Code:
    <?php 
    $Email = $_POST['Email'];
    $Naam = $_POST['Naam'];
    $Voornaam = $_POST['Voornaam'];
    $Adres = $_POST['Adres'];
    $Nr = $_POST['Nr'];
    $PB = $_POST['PB'];
    $Postcode = $_POST['Postcode'];
    $Gemeente = $_POST['Gemeente'];
    $Land = $_POST['Land'];
    $GebDat = $_POST['GebDat'];
    $Maat = $_POST['Maat'];
    $Lid = $_POST['Lid'];
    
    $formsent = mail('leden@bluearmyneerpelt.be','Lid 2007', $Email, $Naam, $Voornaam, $Adres, $Nr, $PB, $Postcode, $Gemeente, $Land, $GebDat, $Maat, $Lid);
    if ($formsent) {
    	echo '<meta http-equiv="refresh" content="0; URL=http://www.bluearmyneerpelt.be/joinin2.html">';
    	} else {
    	echo '<meta http-equiv="refresh" content="0; URL=http://www.bluearmyneerpelt.be/joinin3.html">';
    	}
    ?>

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    <?php
    $Email = $_POST['Email'];
    $Naam = $_POST['Naam'];
    $Voornaam = $_POST['Voornaam'];
    $Adres = $_POST['Adres'];
    $Nr = $_POST['Nr'];
    $PB = $_POST['PB'];
    $Postcode = $_POST['Postcode'];
    $Gemeente = $_POST['Gemeente'];
    $Land = $_POST['Land'];
    $GebDat = $_POST['GebDat'];
    $Maat = $_POST['Maat'];
    $Lid = $_POST['Lid'];

    $formsent = mail('leden@bluearmyneerpelt.be','Lid 2007', $Email, $Naam, $Voornaam, $Adres, $Nr, $PB, $Postcode, $Gemeente, $Land, $GebDat, $Maat, $Lid);
    if ($formsent) {
    echo '<meta http-equiv="refresh" content="0; URL=http://www.bluearmyneerpelt.be/joinin2.html">';
    } else {
    echo '<meta http-equiv="refresh" content="0; URL=http://www.bluearmyneerpelt.be/joinin3.html">';
    }
    ?>
    your mail function is set up wrong... the mail can only support 4 arguments.
    Code:
    mail(_to_, _subject_, _message_, _headers_);
    so lets modify your message code to reflect what u were trying to do

    Code:
    $message =
    "Email: $Email
    Naam: $Naam
    Voornaam: $Voornaam
    Adres: $Adres
    Nr: $Nr
    PB: $PB
    PostCode: $Postcode
    Gemeente: $Gemeente
    Land: $Land
    GebDat: $GebDat
    Maat: $Maat
    Lid: $Lid"
    then we will incorporate that into what you are trying to do to get

    PHP Code:
    $Email $_POST['Email'];
    $Naam $_POST['Naam'];
    $Voornaam $_POST['Voornaam'];
    $Adres $_POST['Adres'];
    $Nr $_POST['Nr'];
    $PB $_POST['PB'];
    $Postcode $_POST['Postcode'];
    $Gemeente $_POST['Gemeente'];
    $Land $_POST['Land'];
    $GebDat $_POST['GebDat'];
    $Maat $_POST['Maat'];
    $Lid $_POST['Lid'];


    $to "leden@bluearmyneerpelt.be";
    $subject "Lidz 07";
    $message =
    "Email: $Email
    Naam: 
    $Naam
    Voornaam: 
    $Voornaam
    Adres: 
    $Adres
    Nr: 
    $Nr
    PB: 
    $PB
    PostCode: 
    $Postcode
    Gemeente: 
    $Gemeente
    Land: 
    $Land
    GebDat: 
    $GebDat
    Maat: 
    $Maat
    Lid: 
    $Lid";

    if(
    mail($to$subject,$message)) {
      
    header("Location: http://www.bluearmyneerpelt.be/joinin2.html");
    }
    else {
     
    header("Location: http://www.bluearmyneerpelt.be/joinin3.html");
    }

    ?> 
    I used a lil different syntax then your <meta> redirect but it accomplishes the same thing, and in a way that will be faster for the user. if you need help with anything else lemme know

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •