473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Creating mailing labels

40
I have developed an address book using php and mysql.I have all the contacts list in a table with check boxes.Now that i want to create mailing labels for the checked contacts...i.e.,the arrangements of addresses should be modified in such a way that there should be 5 addresses in a row of the table...I have done some coding but just dont know how to retrieve the checked contacts..Also..i have some problem in creating labels in which some contacts are missing while listing out row-wise.My code is as follows:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $label=mysql_query("select * from address_book where Name LIKE '%$_POST[searchfields]%' or Company LIKE '%$_POST[searchfields]%'") or die("Query failed  ".mysql_error());
  3. ?>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>Contacts List</title>
  10. <SCRIPT LANGUAGE="JavaScript">
  11. function CheckAll(chk)
  12. {
  13.     for (i = 0; i < chk.length; i++)
  14.     chk[i].checked = true ;
  15. }
  16.  
  17. function UnCheckAll(chk)
  18. {
  19.     for (i = 0; i < chk.length; i++)
  20.     chk[i].checked = false ;
  21. }
  22. </script>
  23. </head>
  24. <body>
  25. <table width="95%" border="0" align="center" cellpadding="4" cellspacing="0" id="t3_tblbg">
  26.   <tbody>
  27.     <tr>
  28.    <td align="center">
  29.   <h3 class="tr1">Create Labels</h3>
  30.   </td>
  31.   </tr>
  32.     <tr>
  33.       <td>
  34.       <form method="post" name="managecontact" action="labelpage.php">
  35.       <table cellspacing="0" cellpadding="4" align="center" width="100%">
  36.  
  37.          <tr>
  38.          <th></th>
  39.          <th align="left" class="tr" width="25%">Name</th>
  40.          <th align="left" class="tr" width="25%">Company</th>
  41.          <th align="left" class="tr" width="20%">Mobile Number</th>
  42.          <th align="left" class="tr" width="20%">City</th>
  43.          </tr>
  44.           <? 
  45.          $count=mysql_num_rows($label);
  46.          if($count>0)
  47.          {
  48.          while($resultset=mysql_fetch_array($label)) {?>
  49.           <TR>
  50.           <td><input type="checkbox" name="checkbox" id="checkbox"></td>
  51.           <td width="10%" align="left" class="tr">
  52.           <a href="result.php?nameID=<? echo $resultset['id'];?>"><? echo $resultset['Name']; ?></a></td>
  53.           <td align="left" class="tr"><? echo $resultset['Company']; ?></td> 
  54.           <td align="left" class="tr"><? echo $resultset['Mobile']; ?></td> 
  55.           <td align="left" class="tr"><? echo $resultset['off_City']; ?></td> 
  56.           </tr>
  57.           <?  } }  ?>
  58.          <tr><td colspan="5" align="center"><input type="submit" name="label" id="label" value="Create Label" />
  59.          <input type="button" name="Check_All" value="Check All" onClick="CheckAll(document.managecontact.checkbox)">
  60.          <input type="button" name="Un_CheckAll" value="Uncheck All" onClick="UnCheckAll(document.managecontact.checkbox)"></td></tr>
  61.       </table> 
  62.         </form>
  63.    </td>
  64.    </tr>
  65.    </tbody>
  66.    </table>
  67. </body>
  68. </html>
  69.  


and the code for label page is:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include "connection.php";
  3. $label=mysql_query("select * from address_book") or die("Query failed  ".mysql_error());
  4. ?>
  5.  
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>Untitled Document</title>
  11. </head>
  12. <body>
  13. <table cellspacing="20" cellpadding="20" align="center" width="100%" cols="5">
  14.            <tr>
  15.            <? 
  16.            $i=1;
  17.            while($resultset=mysql_fetch_array($label)) { 
  18.            if($i<=5) {
  19.            ?>
  20.           <td>
  21.             <? echo $resultset['Name']; ?><br />
  22.           <? echo $resultset['Company']; ?><br /> 
  23.           <? echo $resultset['off_Street']; ?><br />
  24.           <? echo $resultset['off_Location']; ?><br />
  25.           <? echo $resultset['off_City']; ?><br />
  26.           <? echo $resultset['off_State']; ?><br />
  27.           <br />
  28.           </td>
  29.           <?  }  
  30.           else
  31.           {
  32.           $i=0;
  33.           ?>
  34.           <tr>
  35.           <?
  36.           }
  37.           $i++;
  38.           } ?>
  39.           </tr>
  40.       </table>
  41. </body>
  42. </html>
  43.  
Sep 18 '08 #1
2 2091
ak1dnar
1,584 Expert 1GB
I think same question and answer is already posted here .Please post back if its not answered yet.
Sep 19 '08 #2
divyac
40
I think same question and answer is already posted here .Please post back if its not answered yet.
No...this is quite different.that was about sending mails and this is related to creating labels
Sep 19 '08 #3

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

Similar topics

3
by: Mark V. | last post by:
Here's what I have and I'm stumped. I have a table that has several thousand names and addresses. I only want to send to one address in a household. So what I would like to do is create a new...
0
by: Nothing | last post by:
Is there a module that I can add to Access 2000 or above that I can add so that the end user can do mailing labels on teh fly. I know Access can do mailing labels form teh wizard, but I wanted to...
2
by: Bobbie | last post by:
I am trying to make mailing labels. The zip/postal codes are 9 digits (ex: 40601-0223) I ran a query and put in the input mask 00000/-9999;;_ and it works but when I make the mailing labels and...
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
0
by: Lisa | last post by:
I am trying to create a Crystal Report for my ASP.NET application that will allow the user to select a specific group of client addresses to create mailing labels. Since this is an ASP.NET...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
2
by: sal | last post by:
Greets, all I'm trying to create different multiple mailing type labels on a page reading from an untyped dataset anyone have any ideas on how I can get this done without crystal reports a plan...
4
by: Dr Al | last post by:
I have a project which requires the batch import of customer contact information, print mailing labels for those customers who have their date of first letter field in the database set to null, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.