dingodoo Posted January 7, 2015 Share Posted January 7, 2015 I saw the posting for creating a script for a certificate but am struggling to get it to work, i have tried everything I can think of but getting errors. As you can see from this test link there is php errors that cannot be resolved. http://gmdesign.org.uk/xxx I have also added the javascript to a button to print the certificate it but its not working either. I would be grateful for any help you can give. you can download/see my full scripts by viewing the attached files script.zip Quote Link to comment Share on other sites More sharing options...
CroNiX Posted January 7, 2015 Share Posted January 7, 2015 Put session_start() at the very top of the page as the first thing. You have something before session_start() which is outputting something (around line 9). Session won't work if there is ANY output before starting the session. Quote Link to comment Share on other sites More sharing options...
dingodoo Posted January 7, 2015 Author Share Posted January 7, 2015 Put session_start() at the very top of the page as the first thing. You have something before session_start() which is outputting something (around line 9). Session won't work if there is ANY output before starting the session. thanks, i deleted the html text and moved the php to the top, but the print option still does not work on the final page :-( Quote Link to comment Share on other sites More sharing options...
dingodoo Posted January 8, 2015 Author Share Posted January 8, 2015 (edited) spent most of today searching many forums and sites but can still not figure out the print button so it prints it as a pdf or downloads it as a pdf when i click the print button nothing happens. its taken nearly 6 months to get to the stage i am am as php is not my thing so am desperate for help. Edited January 8, 2015 by dingodoo Quote Link to comment Share on other sites More sharing options...
CroNiX Posted January 8, 2015 Share Posted January 8, 2015 Well, if you want an actual PDF, then you have a lot more work to do, probably more than you've done thus far. It's complex, even with a good library to use. I'd suggest looking at FPDF and TCPDF, or google "php pdf library" for more. If you just want to bring up the browsers native print dialog, which is the same as just choosing "print" from your browser, then you'd just change your button slightly and add an onclick event and have it trigger window.print(): <input type="submit" id="Button1" name="" value="print" style="position:absolute;left:129px;top:295px;width:96px;height:25px;z-index:20;" onclick="window.print();"> Quote Link to comment Share on other sites More sharing options...
dingodoo Posted January 9, 2015 Author Share Posted January 9, 2015 Well, if you want an actual PDF, then you have a lot more work to do, probably more than you've done thus far. It's complex, even with a good library to use. I'd suggest looking at FPDF and TCPDF, or google "php pdf library" for more. If you just want to bring up the browsers native print dialog, which is the same as just choosing "print" from your browser, then you'd just change your button slightly and add an onclick event and have it trigger window.print(): <input type="submit" id="Button1" name="" value="print" style="position:absolute;left:129px;top:295px;width:96px;height:25px;z-index:20;" onclick="window.print();"> i added that script as you gave but it only prints the text inputted, ie, the name, it does not print the background or anything else. i am really baffled now Quote Link to comment Share on other sites More sharing options...
CroNiX Posted January 9, 2015 Share Posted January 9, 2015 When I go to the print dialog, it gives me options for printing "background graphics" as mine is called, etc. When enable that your image shows up. The options may vary from printer to printer. It was under advanced settings for me. Not sure on that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.