/    Sign up×
Community /Pin to ProfileBookmark

Fax Cover Sheets

I would like to write a php script that can be used by myself and my coworkers that can be used to make fax cover sheets.

We need it to print on our letter head… which would have to be part of the script and I dont know where to start.

I work for an insurance agency. There are the fields we would need on the fax cover sheets.

1) To
2) Company
3) From
4) Date
5) Policy #
6) Re
7) Fax Body

As I said we would need our name and address at the top of the print out.

I was thinking have an html form where we enter the info… and then when we click fax it formats it… give us a chance to double check it…and then print it to the printer.

We do not need to save the fax covers after they are printer so I dont believe we will need an sql DB. but I could be wrong.

to post a comment
PHP

17 Comments(s)

Copy linkTweet thisAlerts:
@SheldonJun 18.2006 — Just create a form that outputs to a correctly formatted page that you can print.
Copy linkTweet thisAlerts:
@dvdd127Jun 19.2006 — Just create a form that outputs to a correctly formatted page that you can print.[/QUOTE]I am not all that great at php..... that is why i am asking for help doing this
Copy linkTweet thisAlerts:
@NogDogJun 19.2006 — Just create one HTML page with the request form, and in the form tag have the action attribute point to a .php page. That .php page will simply be a HTML page formatted as you desire for your FAX cover sheet. The only difference from a HTML-only page is that at points in the page where you have dynamic data, you will go into PHP mode and echo the applicable variable from your $_POST or $_GET array (depending on whether you opt to use the post or get method in your form tag). For example
[code=php]
<?php // this example assumes you used the POST form method ?>
<table>
<tr><td>To:</td><td><?php echo $_POST['to']; ?></td></tr>
<tr><td>From:</td><td><?php echo $_POST['from']; ?></td></tr>
<!-- et cetera -->
</table>
[/code]

Note: this is a very basic example: it is not the only way to do it and does not do things such as input validation. It is only intended to get you started.
Copy linkTweet thisAlerts:
@dvdd127Jun 19.2006 — ok... using what you provided above... i was able to compile a script that will do the job for me..

only one problem. I used a multiline text box for the body of the fax cover sheet...and need someone to tell me how i can make it create line breakes without the user having to type in <br>.
Copy linkTweet thisAlerts:
@NogDogJun 19.2006 — [url=http://www.php.net/nl2br]nl2br()[/url]
Copy linkTweet thisAlerts:
@dvdd127Jun 19.2006 — [url=http://www.php.net/nl2br]nl2br()[/url][/QUOTE]thanks.
Copy linkTweet thisAlerts:
@dvdd127Jun 20.2006 — ok.. now my next question.

I have set it up so that i have an html page with the form and when the user clicks the print button at the bottom it brings them to a page with everything filled in and some hidden fields show up for the user to verify the fax memo.

what I would like is to have the print window automatically come up when that verification pages loads. is there a way to do that??? or not?
Copy linkTweet thisAlerts:
@NogDogJun 20.2006 — That would have to be done client-side. I think you can just add this to your body tag:
[code=html]
<body onload="javascript: print();">
[/code]
Copy linkTweet thisAlerts:
@dvdd127Aug 10.2006 — is there a way to make it print automatically..... without having the user click ok in the print window.. and then forward back to index.html?

also.. I need to know how to make it so that all pucntuation can be used without a slash appearing in front of the punctuation mark.

thanks in advance.
Copy linkTweet thisAlerts:
@NogDogAug 10.2006 — is there a way to make it print automatically..... without having the user click ok in the print window.. and then forward back to index.html?[/quote]
I don't think so: that would be a real security problem. (Web pages could conceivably send pages and pages of data to your printer without your consent.)

also.. I need to know how to make it so that all pucntuation can be used without a slash appearing in front of the punctuation mark.

thanks in advance.[/QUOTE]

[code=php]
function no_slashes($string)
{
if(get_magic_quotes_gpc())
{
$string = stripslashes($string);
}
return($string);
}

// USAGE:
echo "<p>Name: " . no_slashes($_POST['name']) . "</p>n";
[/code]

The reason for creating the function rather than just using stripslashes() is so that your code will work on any installation, regardless of whether or not "magic quotes" are activated on the host.
Copy linkTweet thisAlerts:
@NogDogAug 10.2006 — PS: regarding the printing, if there is a network printer accessible from your web host, you could possibly use something like shell_exec() to send data to that printer (depending on your PHP security settings).
Copy linkTweet thisAlerts:
@dvdd127Aug 10.2006 — thanks for your help nodog.

do u have to change any of that??? or will it work as is??
Copy linkTweet thisAlerts:
@dvdd127Aug 10.2006 — PS: regarding the printing, if there is a network printer accessible from your web host, you could possibly use something like shell_exec() to send data to that printer (depending on your PHP security settings).[/QUOTE]maybe i am misunderstanding. but i need it to print to the local printer in my office
Copy linkTweet thisAlerts:
@NogDogAug 10.2006 — maybe i am misunderstanding. but i need it to print to the local printer in my office[/QUOTE]
Are you running the PHP page from a local installation on your PC? If so, you might be able to use shell_exec() to send a print request to it. If you're running it from a intranet webserver AND your printer is accessible from anywhere on your LAN, you still might be able to do that. It the printer is not accessible from the web host where your page is running, then that's not an option.
Copy linkTweet thisAlerts:
@dvdd127Aug 10.2006 — Are you running the PHP page from a local installation on your PC? If so, you might be able to use shell_exec() to send a print request to it. If you're running it from a intranet webserver AND your printer is accessible from anywhere on your LAN, you still might be able to do that. It the printer is not accessible from the web host where your page is running, then that's not an option.[/QUOTE]ok. my server is in some datacenter in NJ... my office is in Chicago, IL. are you saying that I would need to be at the datacenter to get the printouts if i use shell_exec()??? or will they print to the printer on my local network in my office in Chicago, IL.
Copy linkTweet thisAlerts:
@NogDogAug 10.2006 — Most likely at the datacenter in NJ. ?

Possibly there's some way to use an ActiveX control or some similar technology to send data from your web page to the printer without clicking a confirm window, but that's beyond my area of knowledge.
Copy linkTweet thisAlerts:
@dvdd127Aug 10.2006 — Most likely at the datacenter in NJ. ?

Possibly there's some way to use an ActiveX control or some similar technology to send data from your web page to the printer without clicking a confirm window, but that's beyond my area of knowledge.[/QUOTE]

its ok. i found out out to make pages forward after loading..

so ill just make it so that it forwards back to the index.html page 5 seconds after the user clicks ok on the print window.

I wanted one or the other. and found out how to do what i wanted... thanks a lot for your help.
×

Success!

Help @davood spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...