473,466 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

This is my php code. whenever i am clicking on submit emails are going to everyone in

3 New Member
Expand|Select|Wrap|Line Numbers
  1. while($religion_res=mysql_fetch_array($religiondata))
  2.           {  
  3.  
  4.                   $_SESSION['registermail']=$email_res2=$religion_res['email'];
  5.                   //$_SESSION['registermail']=$email_res1=$religion_res['email'];
  6.  
  7.  
  8.  
  9.                          if(($religion_res['education']==$education) || ($religion_res['religion_name']==$religion_name) || ($religion_res['height']==$height))
  10.                    {
  11.  
  12.                 ?>         
  13.                         <tr>
  14.                             <td></td>
  15.                             <td class="text"><?php echo $reg_id=$religion_res['matri_id'];
  16.  
  17.                             $_SESSION['registerid']=$reg_id;
  18.  
  19.                              ?></td>
  20.                      <td class="text"><a href="view_matchprofile.php?id=<?php echo $religion_res['matri_id']?>" target="_blank"><?php echo $religion_res['firstname']; ?></a>
  21.                      </td>
  22.  
  23.                       <td class="text"><?php 
  24.  
  25.  
  26.  
  27.  
  28.                      echo $religion_res['lastname'];
  29.  
  30.                       ?></td>
  31.  
  32.                      <td class="text">
  33.  
  34.  
  35.  
  36.  
  37.                    <img src="http://bytes.com/topic/php/photos/<?php echo $religion_res['photo1'];?>" style="border:solid 2px #6f0c20;" width="30" height="30" />
  38.  
  39.                       </td>
  40.  
  41.                      <td class="text"><?php 
  42.  
  43.  
  44.  
  45.  
  46.                      echo $religion_res['religion_name'];
  47.  
  48.                       ?></td>
  49.  
  50.                      <td class="text"><?php echo $religion_res['education']; ?></td>
  51.                      <td class="text"><?php echo $religion_res['height']; ?></td>
  52.  
  53.  
  54.                             <td width="140px">
  55.                                 <table align="center">
  56.                                     <tr>
  57.  
  58.                                      <td style="border:none;"><a href="#">View Horoscope</a>
  59.  
  60.                                      </td>
  61.                                     <?php
  62.  
  63.  
  64. $interest=mysql_query("select * from register where email='$email_res2' && matri_id='$reg_id'");                                   
  65.                                          $interest_data=mysql_fetch_array($interest);
  66.                                          $email_res=$interest_data['email'];
  67.                                          $matri_res=$interest_data['matri_id'];                                                                                
  68.                                      if(isset($_POST['submit1']))
  69.  
  70.                                      {
  71.  
  72.  
  73.                                 //  echo $interest_data['matri_id'];
  74. //                                          exit;
  75.               $insert=mysql_query("INSERT INTO `expressinterest`(`ei_id`, `ei_sender`,`ei_receiver`) VALUES (NULL,'$email_from1','$interest_resf')");    
  76.  
  77.     $interest_resf=$interest_data['email']; 
  78.  
  79.  
  80.  
  81.  
  82.                              $email_from1 = "some@some.com";
  83.  
  84.                 $email_subject1 = "Thank You for showing your interest";      
  85.                   $email_message1 = "Thank You for showing your interest";                                                     
  86.  
  87.  
  88.  
  89.  
  90.                 // $email_message .= clean_string($name)."\n";
  91.  
  92.                     // create email headers
  93.  
  94.                 $headers1 = 'From: '.$email_from1."\r\n".
  95.  
  96.                 'Reply-To: '.$email_from1."\r\n" .
  97.  
  98.                 'X-Mailer: PHP/' . phpversion();
  99.  
  100.                 @mail($interest_resf, $email_subject1, $email_message1, $headers1);
  101.  
  102.  
  103.              ?>
  104.  
  105.              <script>
  106.          alert("send interest successfully");
  107.              </script>
  108.              <?php
  109.                     }
  110.  
  111. ?>
  112. <!--<script>
  113. function myFunction()
  114. {
  115.     window.location.href();
  116. }
  117. </script>-->
  118.  
  119.  
  120.  
  121.                                     <form action="" method="post" name="f1" enctype='multipart/form-data'>
  122.  
  123.                                     <td style="border:none;">
  124.  
  125.                                      <input type="submit" name="submit1" id="" value="Send Interest to <?php echo $religion_res['matri_id']?>" />
  126.  
  127.  
  128.                                      </td>
  129.  
  130.                                     </form>        
  131.  
  132.  
  133.  
  134.                                     </tr>
  135.                                 </table>
  136.                             </td>
  137.                         </tr>
  138.             <?php
  139.          }
  140.  
  141.                   ?>
Apr 10 '15 #1
5 1398
Dormilich
8,658 Recognized Expert Moderator Expert
what’s the (full) question?
Apr 11 '15 #2
Ankit Bhowmick
3 New Member
Email should go to particular email id's. I know the problem why this is happening because submit button is in while loop. But i don't know how to resolve it.
Apr 12 '15 #3
Dormilich
8,658 Recognized Expert Moderator Expert
Email should go to particular email id's.
what does it do instead?
Apr 12 '15 #4
Ankit Bhowmick
3 New Member
Its is a matrimonial site and there are some matching profile and a send interest button is present whenever i click on a particular send request button. Request should go to particular email id present in my database. I want to send email to a particular email id.
Apr 12 '15 #5
RonB
589 Recognized Expert Moderator Contributor
You need to fix your code formatting. Your indentation is very inconsistent making it very difficult to follow its logic.

Since you're sending the email inside a loop, I'd say that is the reason the email is going to more users than you intended.

What is the sql statement you used when assigning $religiondata? If that statement is returning more than one record, than I'd expect it very likely to send an email to multiple people.
Apr 12 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
8
by: MARTIN LANNY | last post by:
Hi everyone, I am having a real trouble to figure out how to amend this code to switch from GET to POST method. -------------------------------------------------------- Public Function...
2
mmarif4u
by: mmarif4u | last post by:
Hi Everyone. I have html page coding: HTML coding..... --------------------------------------------------- <h2>Search</h2> <form name="search" method="post" action="Search.php"> Seach for:...
2
by: roohbir | last post by:
I was going through this code from Negrino's JavaScript for the WWW book. I have 2 questions: 1. Why has the author used validForm(passForm)? I mean what is 'passForm' in the function? 2. And its...
1
by: valmae | last post by:
Please help anyone! I am getting this error after the submit button is clicked to this form which was designed in Dreamweaver in ASP. Microsoft VBScript compilation error '800a0401' Expected...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.