SitePoint Sponsor

User Tag List

Results 1 to 20 of 20

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question need some guidence about a poster

    i have a web site for lost and found pets in plymouth
    you fill out a form with the details etc and this then gets put in a database but what i want to do is from the form use the details in a poster as well that they can print off if they want to at the same time
    if you see what i mean
    and i havnt got a clue where to start
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Morning Doug,

    You could use many of the PHP PDF libraries to create a poster.

    Take a look at FPDF and TCPDF.

    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks bullet
    that looks complicated to me will have to study it a bit more
    but cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If that looks like too much work then consider this.

    Manipulate your html output slightly so that you have a div inside your page that contains, the heading, the photo, some text.

    Make a css file called print.css and in that hide everything except that div, you can set the font size and image orientation so that it will print onto a single page from most printers.

    Otherwise, hide everything and just reveal the items in your DOM that you want printed, and tell the print stylesheet to do the rest.

    You could have a large H1 that is hidden from the webpage view that only appears in the print view saying "L O S T" at the top.

    Code:
    <h1>Your normal header</h1>
    <h1 class="print">L O S T</h1>
    <img src = "dog23.jpg" />
    your normal css would have a rule like;

    .print {display: none ;}

    I am sure a couple of us will test it on our kit at home too for you if you wanted to be reassured it printed on a number of OS/Browser/Printer combinations.

    More here:
    http://www.google.co.uk/search?q=print+only+css

    The PDF would probably look much nicer though.

  5. #5
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have a div on form called pager
    this is the code

    HTML Code:
    <div id="pager">
    		<div class="innerpage">
    			<h3>Report</h3>
    				<p>Here you can Report Lost or Found Pets</p>
    				<form action="add1.php" method="post" enctype="multipart/form-data">
       <table width="604" border="0" cellspacing="5">
        <tr>
          <td><span class="style2">Name: <span class="style3">not shown</span></span></td>
          <td>
            <div class="style2">
              <input name="name" type="text" id="name" size="30" />
            </div></td>
        </tr>
        <tr>
          <td><span class="style2">Email:</span> not shown</td>
          <td><input name="email" type="text" id="email" size="30" /></td>
        </tr>
        <tr>
          <td><span class="style2">Tel:</span></td>
          <td><input name="tel" type="text" id="tel" size="15" /></td>
        </tr>
        <tr>
          <td><span class="style2">Lost/Found:</span></td>
          <td><select name="state">
              <option value="lost">LOST</option>
              <option value="found">FOUND</option>
            </select>
              <br /></td>
        </tr>
        <tr>
          <td><span class="style2">Dog/Cat:</span></td>
          <td><select name="type">
              <option value="dog">Dog</option>
              <option value="cat">Cat</option>
            </select>
              <br /></td>
        </tr>
        <tr>
          <td><span class="style2">Area: Found or Lost</span></td>
          <td><input name="area" type="text" id="area" size="30" /></td>
        </tr>
        <tr>
          <td valign="top"><span class="style2">Description:</span></td>
          <td><textarea name="desc" cols="30" rows="6" id="desc"></textarea></td>
        </tr>
        <tr>
          <td>Photo:</td>
          <td><input type="file" name="pic" /></td>
        </tr>
        <tr>
          <td>Anti-Spam Question. How many legs on a Dog ?</td>
          <td><input name="leg" type="text" id="leg" size="3" /></td>
        </tr>
        <tr>
          <td><input name="send" type="submit" id="send" onclick="MM_validateForm('name','','R','email','','NisEmail','tel','','RisNum','area','','R','desc','','R');return document.MM_returnValue" value="Send" /></td>
        </tr>
      </table>
    </form>
    where do i go from here
    with the css.print to start with
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I would have thought you make another page which retrieves the record of a single lost pet. You then put the div tags where you like.

    How do you get the records out for review at the moment then?

  7. #7
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i wanted the poster to be available when peeps are reporting lost or found
    so they fill the above report out then i say put a button on bottom to say some thing like preview poster before the info goes to database
    if you see what i mean
    this may not be poss i dont know
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  8. #8
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I had assumed you would save the data, then allow them to view/print a poster.

    This would be easier to implement if, as I had assumed - perhaps wrongly, that they were submitting you an image of the lost pet.

    If this is not the scenario perhaps you'd better explain a little more.

  9. #9
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for reply Cups
    i did have one thought and that was to make a web page filled out with details as a sample then let them edit it as nes
    i am presuming if i made it an editable web page that would be a lot simpler
    please let me know what you think
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  10. #10
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If you mean have a form that does not submit any data, just creates a poster, I dont see how that would work without a lot of JS jiggery-pokery.

    When someone reports a lost pet, do you store the details at the moment? If so, how?

  11. #11
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at the moment when the form is filled out it sends it to a database
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  12. #12
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So why not just create a page which retrieves a single record i.e. name, tel, photo etc into a page which is optimised for printing using the methods I linked to and call it "create a poster"?

  13. #13
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok buddy i think i see what you mean
    so i would need a page to login with there name
    then another page with all the details
    got it in theory now to try in practice he he he
    cheers
    one question
    in mysql select where name = ?
    how do i use a variable for the name
    cheers
    Doug

    PHP Code:
    //Retrieves data from MySQL

     
    $data mysql_query("SELECT * FROM register where name =?") or die(mysql_error());

    //Puts it into an array 
    while($info mysql_fetch_array$data )) 

    //Outputs the image and other data
    Echo "<b>ID:</b> ".$info['id'] . " <br>";
    Echo 
    "<b>Type:</b> ".$info['type'] . " <br>";
    Echo 
    "<b>State:</b> ".$info['state'] . " <br>";
    Echo 
    "<b>Area:</b> ".$info['area'] . " <br>";
    Echo 
    "<b>Description:</b> ".$info['desc'] . " <br>";
    Echo 
    "<b>Name:</b> ".$info['name'] . " <br>";
    Echo 
    "<b>Email:</b> ".$info['email'] . " <br>";
    Echo 
    "<b>Tel:</b> ".$info['tel'] . " <br>";
    Echo 
    "<b>Date of listing:</b> ".$info['date'] . " <br>";

    Echo 
    "<hr>";

    mysql_close();

    ?> 
    Last edited by dougvcd; Apr 16, 2009 at 06:56. Reason: more info
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  14. #14
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You are using the ? as if you are using the PDO or Mysqli extensions, called a placeholder. You need to make sure they are installed before you can use them (check your phpinfo() readout)

    If, as your sample suggests, you are using the straight mysql_* functions then you need to pass it the name from the previous form.

    $_GET['name'] = "Snowy" ;

    like so:

    'SELECT
    *
    FROM register
    where name = "' . mysql_real_escape_string( $_GET['name'] ) .'"';

    HTH

  15. #15
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok cupps have got a bit further now
    have the page displayed on screen would you have a look and see what you think
    now the next step is the printing
    ok the web site is
    djbcaravanhire.co.uk
    choose poster maker
    and name Doug
    cheers
    Doug
    this is my testing site
    Last edited by dougvcd; Apr 17, 2009 at 03:35. Reason: more info
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  16. #16
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Seems fine to me, though the print button appears on the print preview and on hard copy, which you probably wouldn't want. (tested on win/FF3/laserjet 4000)

    The url appearing on the page can only be removed by the user changing their browser settings locally, but you could use it to create a url straight to the correct record.

    www .yoursite/lost-pet/doug

    You just need to continue to tailor the output to suit something which would appear in a shop window, because presumably the posters will go up around where the pet was lost.

    You could go on and use SBs idea, and create a pdf from the information.

  17. #17
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers for that how do i stop the buttons from printing as just added another for home
    i did look at pdf but could not understand how to use it
    i did see on the net a html to pdf converter not sure if that would do
    but a BIG thanks for your help
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  18. #18
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Thats just a matter of creating an @print rule containing;

    input {display:none;}

    e.g. change the css to this, and print preview, the buttons have gone.
    Code CSS:
    <style type="text/css" media="screen">
    .style1 {
    	text-align: center;
    	font-size: xx-large;
    }
    .style2 {
    	text-align: center;
    }
     
    </style>
     
    <style type="text/css" media="print">
    .style1 {
    	text-align: center;
    	font-size: xx-large;
    }
    .style2 {
    	text-align: center;
    }
     
    input {display: none; }
     
    </style>
    HTH

    Do you see how you could potentially make any page which contain the record of a lost pet into a print-friendly poster just by juggling the elements on the page and having appropriate css settings?

  19. #19
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry Cups have made a mistake and cant find what i have done wrong
    using your code all was ok then i took your code and put it in a css page
    now it dont work if you could have a quick look
    cheer
    Doug
    ok here is print.css
    PHP Code:
    <style type="text/css" media="screen">
    .
    style1 {
           
    text-aligncenter;
           
    font-sizexx-large;
           
    color:blue;
    }
    .
    style2 {
           
    text-aligncenter;
           
    font-size:x-large;
           
    font-weight:bold;
           
    color:black;
    }
    .
    style3 {
           
    text-aligncenter;
           
    font-size:xx-large;
           
    font-weight:bolder;
           
    color:maroon;
    }

    </
    style>

    <
    style type="text/css" media="print">
    .
    style1 {
           
    text-aligncenter;
           
    font-sizexx-large;
    }
    .
    style2 {
           
    text-aligncenter;
    }

    input {displaynone; }

    </
    style
    and here is what i put on select.php page
    HTML Code:
    <title>Select</title>
    <link rel="stylesheet" href="print.css" type="text/css" />
    </head>
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  20. #20
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You need to read the info on those sites that google found with that search higher up.

    <style> tags are not stored in a css file, just the rules.

    You have to link to the css file with the correct media attribute.
    Code:
    <link rel="stylesheet"
       type="text/css"
       media="print" href="print.css" />
    http://www.alistapart.com/articles/goingtoprint/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •