Find pdf file with input form - php

I want my client to be able to download their invoice from my website.
If you have better suggestion, feel free to let me know.
I want 2 input fields. Postal code and phone number then a submit button that will go retrieve the PDF file matching the input.
<form action="#" method="post" name="Facture" class="bodytext" id="Facture">
<input name="postal" type="text" id="postal" onclick="this.value=''" value="Code Postal | H1H 1H1" size="26" /><br />
<input name="telephone" type="text" id="telephone" onclick="this.value=''" value="Téléphone | 000-000-0000" size="26" /><br />
<input class="submit" type="submit" name="envoyer" id="envoyer" value="Chercher" />
</form>
All invoices will be in a folder, let's say /invoices and file name will be H1H1H10000000000.pdf.
I want the submit button to download the file corresponding to input fields joint together.
This is what I planned but if you have a better idea to help me, all I want is my client to be able to print/download their PDF invoice and try to make sure it still private and secure.

Related

Joomla! Contact form inside an article, can't get action php file working

I'm trying to create a contact form on my own. I noticed that it can be achieved by placing the form inside an article, instead of a custom html module.
In the client side, it seems to work. I even added a captcha manually (the re-captcha plugin doesn't seem to work for me). The problem is, I set form's action property as "mail.php", and just added this "mail.php" file to the the template root. The "mail.php" supossedly retrieves the data send by post, and finally composes and sends the email, showing a "message send" notification.
Anyway, when I click on submit, the form page is just reloaded. I guess that Joomla! can't find my "mail.php". I guess that this issue is related to the joomla structure and my inability to place the "mail.php". Any help will be wellcome.
This is how my article looks like (wysiwyg editor mode disabled):
<form action="mail.php" method="post" target="_blank">
<p><label for="nombre">Nombre:</label></p>
<p><input maxlength="50" name="nombre" size="30" type="text" /></p>
<p><label for="email">Email:</label></p>
<p><input maxlength="50" name="email" required="required" size="30" type="text" /></p>
<p><label for="asunto">Asunto:</label></p>
<p><input maxlength="150" name="asunto" size="30" type="text" /></p>
<p><label for="mensaje">Mensaje:</label></p>
<p><textarea cols="50" maxlength="700" name="mensaje" required="required" rows="8"></textarea></p>
<div class="g-recaptcha" data-sitekey="6Lefblahblahblahblah"> </div>
<p><input type="submit" /></p>
</form>

2 form actions in interspire email marketer

My client is using interspire email marketer, which generate html form, and save all data into crm database.
In the form, there is a postcode area, my client wants to send email alert to different department based on this postcode.
I am thinking to create a seperate php file to match the postcode and send email alert.
But there is already a form.php in action. How can I add another action? Or is there any better way to achieve this?
Many Many thanks.
Below is the form code:
<form name="ppt_form" class="ppt-form" method="post" action="http://na03.mypinpointe.com/form.php?form=332" id="frmSS332">
<p><span class="required">*</span>Your Email Address:<br />
<input type="text" class="email" name="email" fid="e" fname="Email" ftype="Email" reqd="1"/></p>
<p>Phone:<br />
<input type="text" name="CustomFields[8]" id="CustomFields_8_332" value="" fid="8" fname="Phone" size='50'></p>
<p>Postal: <br />
<input type="text" name="CustomFields[20]" id="CustomFields_20_332" value="" fid="20" fname="Postal" size='50'></p>
<p><input type="button" class="update-button" value="Submit"/></p>
</form>
Eventually I leave the form with 1 action.
and add a ajax on button click.

HTML Forms to query multiple pages

i am trying to build a meta search engine.
I currently have the following code.
<form method="POST" action="google_basic.php">
<label for="service_op">Service Operation</label><br/>
<input name="service_op" type="radio" value="Web" CHECKED />
Web <input name="service_op" type="radio" value="Image" />
Image <br/> <label for="query">Query</label><br/>
<input name="query" type="text" size="60" maxlength="60"
value="" /><br /><br /> <input name="bt_search" type="submit"
value="Search" /> </form> <h2>Results</h1>
{RESULTS}
I need the form to have more than one action= ""(I realise a form can only have one action, i need the equivalent of 3 actions ="" ). The form needs to access 3 search engines and display the results. What is the best way to do this?? I know that javascript may an option but is not a solution for me as it may be switched off in the clients browser.
Any ideas on the best way to go about this??
TIA
You need to perform the 3 "actions" on the server (in or from the google_basic.php file). After POSTing to the server, you can perform an arbitrary number of "actions" from there.
See also: http://us2.php.net/manual/en/intro.curl.php
it only needs one action, then the action is what will display all 3 searches. so instead of having google_search.php, bing_search.php, and yahoo_search.php, combine them all into a generic search page that will display all 3

Concurrency control with php /ajax?

Assuming a situation like this, a page with simple form input phone number and it allow multi user - access:
<form>
Name: * <input type="text" name="name" /><br />
Phone: (if any) <input type="text" name="phone" /><br />
</form>
The phone field in database is pre-defined as allow-null.
The problem is when user A inputting the form , user B modify the database and set phone field as not-null . When user A submit , the phone will be a null value and post to the mysql database.
What i want to achieve is , if that field is modifyied to non-null, it should refresh before submit, retrieve the database structure before submit. Once there is difference, it return to the form and display like the following
<form>
Name: * <input type="text" name="name" /><br />
Phone: * <input type="text" name="phone" /> Sorry. You have to enter phone number<br />
</form>
How can it implement base on php(if possible)/ ajax? Thanks for the help.
Its quite weird to implement any refresh before submit and make decisions on browser side.
Such a situation should be checked on PHP side (after submit), which should return an error result-code meaning "The field is not null any more, please provide a value"

Posting jquery appended input boxes to MYSQL

We have a very large form and we are posting the data to mysql using $_POST, but we have 2 complex sections in the form where we need your help.
HTML markup of form
<label>Customer Name</label>
<input type="text" size="50" name="name" />
<label>Education</label>
<input type="text" size="50" name="class" />
<input type="text" size="50" name="board" />
<input type="text" size="50" name="subjects" />
<input type="text" size="50" name="aggregate" />
<label>Payment Plan</label>
<ul id="fields"></ul>
We are appending following to #fields using jquery
<li><input type="text" size="30" name="date" /> <input type="text" size="30" name="amount" /> </li>
Now we would like your help with the following problems...
How to post education details to mysql table? - using php serialise?
how to post appended input boxes to mysql's tbl.paymentplan?
If you've populated the fields using jquery (date & amount) and it's on the form, a simple "Submit" button which posts to a PHP page that handles the insert into the database should work fine.
Nothing complex about it. I use jquery to pre-load form data all the time like that.
If you want to avoid doing a postback entirely, and want to do that through jquery as well, you can. Once the data is loaded into the DOM and the form displays it you can do with it what you want.
Algorithm
use mysql_fetch_field to know all attributes name from your table
if attribute does not exist in current table then update table via php like below
mysql_query("ALTER TABLE paymentplan
ADD date CHAR(30) AFTER subject,
Add payment CHAR(30) AFTER date");
and then insert the data the way u want.
Reference
mysql fetch field

Categories