Help php form

oldBastard

Expert Member
Joined
Jul 28, 2006
Messages
4,751
Reaction score
1,234
Location
Somewhere near your mom
Hi guys

Need some help on a php form.

The current process;

1. User fill in form.
2. A confirmation is echoed with the data.
3. User click print to print the page to fax to customer and then click submit to submit to MySQL db.

But I have instances where the lusers click print and then go fax and then close the page without submitting the actual data to the db.

Is there a way in java or any other coding form to preform an onclick on print to actually submit the data to the db and then do a header() back to the main page?
 
Without actually posting the form, the only way you can do it is via an AJAX function. In short you can call the function and it can return a popup or whatever saying "information submitted".
I'm assuming you meant "javascript" and not "java" ;)
 
you can use jquery to call the onclick() event of the submit button when the user clicks print.
 
You should always log your form to MySQL first before any other process. Use a field (eg status) to identify where in the process flow the user is (eg PENDING; COMPLETED; CANCELED)

You can even capture what actions the user did. Never ever rely on the end user to do what you intended them to.
 
You should always log your form to MySQL first before any other process. Use a field (eg status) to identify where in the process flow the user is (eg PENDING; COMPLETED; CANCELED)

You can even capture what actions the user did. Never ever rely on the end user to do what you intended them to.

Agreed.

So during the submit process rather execute a start session () and carry over it to the confirmation, well more of a printing page?
 
What's a fax? So, we're making a form to fax something then to add to DB? Why the hell are we faxing in this day and age?
Perhaps a better workflow would be
FORM completed --submit-->enter into db-->render print page for faxing.
 
The nicest way to do this would be to use ajax. if the DB insert was a success, then render the print/fax page.

What ajax helps with is, running the php insert script in the background, without the user even knowing about it.

How much do you know? Php, htlm javascript? If none, then I'll quickly post a sample of what I would do.
 
Last edited:
Please post your code so far so we can have a look.. If you want to print and add to the DB at the same time just put the code for both in one function that is executed onClick.
 
Top
Sign up to the MyBroadband newsletter
X