PHP or Java Script Needed

Discussion in 'Programming' started by MrStitch, Jul 13, 2007.

  1. #1
    I've got a website where I want to offer the user to generate raffle tickets with their business name on them.

    I need a form, with a single field for business name.

    The tickets would look like.....

    Business Name

    Name:____________
    Address:_____________
    Phone:______________

    I would like the user to be able to key in the business name, click 'Create Tickets', and have their printer box pop up asking how many copies (the usual printer box), etc.

    If the user selects 'one' page to be printed, then about 10 tickets would print out on one sheet of paper. They would then just cut them out and use 'em.

    I already have the webpage (and site for that matter) created. Just need the code that will go under my <body> tag.

    Payment - Lets face it, I'm broke. The only thing I got that I can offer is a link from my blog in my sig, and/or a post with your links in it from said blog. (i'm pretty lenient on what I link to, but I won't link to porn) If I could offer more, I would.

    Thanks for any help, and of course there is some green in it for anyone that participates.
     
    MrStitch, Jul 13, 2007 IP
  2. MrStitch

    MrStitch Peon

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Just a thought here, and I really don't have any idea how doable this is....

    But what if I had some sort of external file, like an excel spreadsheet, text document, whatever.... and the code simply replaced the line of text with whatever the user put in the field, and then spat it out to the printer?

    Uhg... I wish I knew more about programming. :(

    *Edit* I guess I should mention that it would be nice (but not required I guess), if I would be able to receive an e'mail any time someone uses the ticket generator. Just for tracking purposes of course.

    I suppose G analytics would be good enough tho. Just a thought.
     
    MrStitch, Jul 13, 2007 IP
  3. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    As Seller:
    100% - 0
    As Buyer:
    0.0% - 0
    #3
    I would do this but only if you were paying. You should try and scrape some money together.
     
    papa_face, Jul 13, 2007 IP
  4. MrStitch

    MrStitch Peon

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    I know..... any programmer willing to do this absolutely deserves money for it.

    When I say I'm broke, I really mean it..... The wife deposited $450 in our checking account the other day, and our new balance was -$200. How sad is that?

    Yes, it's a sob story, but it's all I got. :(
     
    MrStitch, Jul 13, 2007 IP
  5. e39m5

    e39m5 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    I don't think selecting the number of copies in the printer box itself will work. Rather, you will need to generate each ticket within the webpage and have the user print 1 copy. If you know HTML this should get you going, just save as a PHP document. <?php echo $business; ?> makes the business name appear.

    
    <?php
    if(!isset($_POST['submit'])){
    ////////// THIS IS YOUR FORM
    ?>
    <form action="#" method="POST" name="tickets">
    Business Name: <input type="text" name="name"><br>
    Number of Tickets: <input type="text" name="num"><br> 
    <input type="submit" name="submit" value="Generate">
    </form>
    <?php
    ////// Your form ended    
    } else {
        $business = $_POST['name'];
        for($i=0;$i<$_POST['num'];$i++){
        // this is the HTML for each ticket
    ?>
    <div>
      <b><?PHP echo $business; ?></b><br><br>
      Name:_______________<br>
      Phone:_______________<br>
      Address:_______________
    </div><br>
    <?php
       //This ends the ticket HTML
        }    
    }
    ?>
    
    PHP:
    Hope this helps.

    e39m5
     
    e39m5, Jul 13, 2007 IP
  6. e39m5

    e39m5 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    And PS: You can use <?PHP echo $i; ?> if you want the number ticket to show up.
     
    e39m5, Jul 13, 2007 IP
  7. MrStitch

    MrStitch Peon

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    So, I just copy that whole box of code, into my existing page? I'll give it a shot....

    Also, just in case I didn't make myself clear, I don't want the user to key in their business name AND number of pages to print.

    Just key in the business name, and hit the print button. Then the website would somehow cue the users local printer for a print job. Just like when you tell anything to print on your computer, a box would pop up asking you how many copies to print, do you want it landscape, set the printer properties for quality, etc. Know what I mean?
     
    MrStitch, Jul 13, 2007 IP
  8. e39m5

    e39m5 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    I think if you have a block of text on a webpage and tell it to print multiple copies it would print one tick per page.

    e39m5
     
    e39m5, Jul 13, 2007 IP
  9. MrStitch

    MrStitch Peon

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    K.... So I gave it a shot. I copied and pasted the code.

    Looks like the business name box comes up, the number of copies box comes up, the 'generate button' is there, and down below there is the ticket information.

    However, keying in the data and hitting the button doesn't quite do anything.

    Second of all, my gut tells me that if the only way to make this work is to have the user print the html page, then the user will need to be redirected to another page, other wise they'd be printing out my header logo, nav menu, and anything else thats there.

    Thoughts?
     
    MrStitch, Jul 13, 2007 IP
  10. MrStitch

    MrStitch Peon

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    Oh... yeah, that wouldn't be too good in this situation, as the user will most definitly want maybe 200 tickets at a time. (at least 8-10 tickets per page). If we do one ticket per page, they'd be wasting a lot of paper. hahahah :D
     
    MrStitch, Jul 13, 2007 IP