Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/293729-create-a-certificate-script-help/
Share on other sites

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.

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 :-(

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 by dingodoo

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();">

 

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.