Check for various emails addresses

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfaisalwarraich
    New Member
    • Oct 2007
    • 194

    #1

    Check for various emails addresses

    Hi, I have form which have 10 fields of emails. like below

    1. Friend's Name: Friend's Email:
    2. Friend's Name: Friend's Email:
    3. Friend's Name: Friend's Email:
    4. Friend's Name: Friend's Email:
    5. Friend's Name: Friend's Email:
    6. Friend's Name: Friend's Email:
    7. Friend's Name: Friend's Email:

    each of the above field has an input also. my question is this how i can check if the email address is present on which serial number? would anybody help me my doing this with function or some other method/procedure?
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    How does the actual HTML look like?

    Comment

    • mfaisalwarraich
      New Member
      • Oct 2007
      • 194

      #3
      Originally posted by Atli
      Hi.

      How does the actual HTML look like?
      sorry i dont understand ur question? well it is a form. which have two different input fields one is Friends Name and other is Friend's Email. i wana refer something to my at least 10 friends then how i can check that if the email address is entered at which field.

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        I simply mean; can we see the markup for your form?

        There are a lot of different ways your form could be set up.
        If we know exactly how it looks like we are not forced to guess, which means we can provide much better suggestions.

        We really don't like guessing :)

        Comment

        • mfaisalwarraich
          New Member
          • Oct 2007
          • 194

          #5
          ok here is the code

          [HTML]<form id="referfriend " method="post" style="display: none" action="adverti sewithus.php?ac tion=check">
          <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="WHITE" align="center" >
          <tr>
          <td colspan="4" align="CENTER" height="25" CLASS="bluebox2 " ><h3> Refer A Friend</h3></td>
          </tr>
          <tr class="tableTex t">
          <td align="LEFT">Yo ur Name</td>
          <td align="LEFT" > <input name="name" type="text"></td>
          <td align="RIGHT">Y our Email</td>
          <td align="LEFT"><i nput id="email" name="email" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="LEFT">1. Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e1" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 1" name="friendema il1" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">2 . Friend Name</td>
          <td align="LEFT" ><input name="friendnam e2" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 2" name="friendema il2" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">3 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e3" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 3" name="friendema il3" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">4 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e4" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 4" name="friendema il4" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">5 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e5" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 5" name="friendema il5" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">6 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e6" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 6" name="friendema il6" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">7 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e7" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 7" name="friendema il7" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">8 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e8" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 8" name="friendema il8" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">9 . Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e9" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 9" name="friendema il9" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT">1 0.Friend Name</td>
          <td align="LEFT"><i nput name="friendnam e10" type="text"></td>
          <td align="RIGHT">F riend Email</td>
          <td align="LEFT"><i nput id="friendemail 10" name="friendema il10" type="text"></td>
          </tr>
          <tr bgcolor="#FFFFF F" class="tableTex t">
          <td align="RIGHT" WIDTH="19%">Bod y</td>
          <td colspan="4" align="CENTER"> <textarea name="mailbody" cols="20" rows="7"></textarea></td>
          </tr>
          <tr bgcolor="#FFFFF F">
          <td colspan="4" align="center"> <input name="referSubm it" id="" type="submit" value="Submit" valign="middle" ></td>
          </tr>
          </table></form>[/HTML]
          Last edited by Atli; Sep 25 '08, 09:50 PM. Reason: Added [code] tags.

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            Ok.

            If you give several <input> elements the same name, and if that name ends with [], then PHP will read all those elements into an array when they are submitted.
            Which means you could add as many of those <input> elements as you want to your form and have your PHP go through all of them with a simple foreach loop.

            So, if you were to name all your Name inputs "name[]", and all your Email inputs "email[]", then a loop like this would print the value for each of them once they were submitted:
            [code=php]
            foreach($_POST['name'] as $_index => $_name)
            {
            $_email = $_POST['email'][$_index];
            echo "$_index - Name: $_name, Email: $_email<br />";
            }
            [/code]
            You could use the empty and isset functions to eliminate empty rows and only use those who pass your validation.

            Also...
            Use [code] tags when posting you code examples.
            As a full member I expect you to know this by now.
            Please keep that in mind in the future.

            Thank you.
            Moderator

            Comment

            • mfaisalwarraich
              New Member
              • Oct 2007
              • 194

              #7
              Thank u for ur help n support i got ur answer i think the empty field can be eliminated using if(!$friendmail =="") then do this. and im sorry posting my reply without code tags. i appologize and sincerely hope that u shall always keep helping me. thank u once again

              Comment

              Working...