473,692 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating mailing labels

40 New Member
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 2111
ak1dnar
1,584 Recognized Expert Top Contributor
I think same question and answer is already posted here .Please post back if its not answered yet.
Sep 19 '08 #2
divyac
40 New Member
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
4681
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 column that runs a macro or whatever it takes to flag records so they are housholded. Some records have a Father and son at the same address, so I would only want to generate a count in my query that gives me one record for that household, a head of...
0
338
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 have a predefined format and only prompt the end user fo rthe Label type, Avery or what ever, and then model # of the labels, 8810 or what ever. Any one have any ideas?
2
2032
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 it pulls in the data the dash is missing (Ex: 406010223). Does anyone know how I can get the dash to follow to the labels? I tried using the wizard and I also built them manually. Any suggestions would be appreciated. Thank you,
3
4324
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 using a report I created and then printing them on a continuous-feed dot matrix printer. I used the Label Wizard, chose the query I created, picked the 'Avery USA 4146' (1 7/16" x 4") - 3 across, paper size: 'Fanfold 358mm x 12 in', and Printer:...
3
2332
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. Also, I am using a "Report Header" to show a count of how many total labels that are being printed. Now, my problem is that without the "Report Header", the spacing is perfect. But, when I add the Report Header, it gets shifted downwards and the...
0
1306
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 application, I would prefer not to include my connection information within the application itself and therefore planned to use the "Push" Method. If I try to use the wizard to create the labels and then use the following code in my aspx page I get...
2
13526
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 execute a MailMerge to create mailing labels or customized letters. A label name known to MS Word MailMerge mailing label wizard may be used or a template file containing the field names Line1 thru Line5 for each record to be printed. If a...
2
1521
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 text file would be fine. My untyped dataset looks like this (comma denotes next cell in untyped dataset) Name,Address,Age
4
2031
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 update the date of first letter field with the date the mailing labels are printed. I already have a query which checks the date of first letter field, and returns those customers whose date of first letter field is null. How do I setup to...
0
8603
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8537
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9081
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8796
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8800
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7627
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6459
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2236
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1957
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.