View unanswered posts | View active topics It is currently Wed Aug 17, 2022 2:49 pm

Reply to topic  [ 2 posts ] 
 printing mailing label without blank line 
Author Message
Junior Member

Joined: Mon May 10, 2004 3:25 am
Posts: 1
i have a problem.i want to print mailing label using pdf.


$pdf->Add_PDF_Label(sprintf("%s\n%s\n%s\n%s\n%s %s\n%s %s", "".ucwords($realname)."", "".ucwords($address1)."", "".ucwords($address2)."", "".ucwords($address3)."", "$postcode", "".ucwords($city)."", "".ucwords($state)."", "".strtoupper($country).""));

if one the data is empty,i dont want to leave a blank like,like as below:



assume there is no data for address2,it will leave a blank space there.i dont want this to happen.i want to put something like this as below:


$pdf->Add_PDF_Label(sprintf("%s if(!empty($address1))\n%s if(!empty($address2)){\n%s}if(!empty($address3)){\n%s}if(!empty($postcode) or !empty($city)){\n%s %s}if(!empty($state) or !empty($country)){\n%s %s}", "".ucwords($realname)."", "".ucwords($address1)."", "".ucwords($address2)."", "".ucwords($address3)."", "$postcode", "".ucwords($city)."", "".ucwords($state)."", "".strtoupper($country).""));

but it display error when i put the condition(if statement) inside the to put the condition inside?

Mon May 10, 2004 3:30 am
Report this post
Junior Member

Joined: Sat May 10, 2003 1:39 pm
Posts: 37
for 1 address line,

$address = sprintf("%s%s" ,
         empty($address1)?"":"\n" );


Sat May 15, 2004 4:24 pm
Report this post
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
© Copyright 2003-2008 The ultimate PHP Editor and PHP IDE site.