2 form actions in interspire email marketer - php

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.

Related

How to integrated payment gateway in my form

Really I am confused how to start..
I have a submit form in my webpage. which contains name, address, email etc. along with Amount To Be Paid (fetched from mysql database).
Now I want user to redirect to payment gateway with amount ((which is not fixed, but changing) and ONLY after successful payment, the form should be get submitted and data should be get added to mysql database.
I have downloaded Instamojo payment gateway api details and I already have active account on Instamojo.
My current code for Submit Form is as follows...
<?php
include("db.php");
if($_POST['action']=="registration"){
$all_columns[]="fname";
$all_columns[]="mname";
$all_columns[]="lname";
$all_columns[]="email";
$all_columns[]="amount_paid";
$all_values[]=addslashes($_POST["fname"]);
$all_values[]=addslashes($_POST["mname"]);
$all_values[]=addslashes($_POST["lname"]);
$all_values[]=addslashes($_POST["email"]);
$all_values[]=addslashes($_POST["amount_paid"]);
$qry=$estambha->webdreaminsert("registration",$all_columns,$all_values,'','','');
$_SESSION["Register_id"]="suceess";
header("location:registration-confirm.php");
}
?>
And HTML Form code is as follows :
<form name="registration_form" id="registration_form" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="action" value="registration" />
Name :<br />
<label for="fname">First Name :</label> <input name="fname" type="text" id="fname" required/>
<label for="mname">Middle Name :</label> <input name="mname" type="text" id="mname" required/>
<label for="lname">Last Name :</label> <input name="lname" type="text" id="lname" required/>
<br />
<br />
E-mail :<br />
<input name="email" type="text" id="email" required/>
<br />
<br />
Registration Amount:<br />
<?
$paymentdata=mysql_query("select * from event_calendar where branch='Nk' group by part DESC limit 1");
$numrows1=mysql_num_rows($paymentdata);
while($amount=mysql_fetch_array($paymentdata)){?>
<input type="text" id="amount_paid" name="amount_paid" value="<?=$amount['fees_for_online']?>" readonly="readonly" />
<? }?>
<input name="formsubmit" type="submit" id="inputsubmit1" value="Register Me" />
Currently After Form Submission, Data get added to mysql database. But I want To Redirect user to Instamojo Payment Gateway Page with Amount from readonly field and after successful payment, user should redirect to registration-confirm.php page and during this data should be get added to mysql.
I am not getting any idea how to do this. I went through Instamojo documents too...Till searching for solution...
ok, let me start with the simple basic process which is followed by all payment integration modules (Process is based on authorized and paypal payment gateway).
1) Collect the data required you payment like user information and payment details like amount and quantity.
2) Payment gateway provides a form which need to be submitted on their sandbox account (URL given in documentation). you can submit the form either CURL or by simple jquery form submit. If you are using jQuery then form must be generated on runtime.
3) In the form provided by the payment gateway, there are two URL success url and the fail url. When the user transaction is complete depends on result, payment gateway redirect to your site on either URL.
4) Get the responce return by payment gateway on relevant success or fail page and process the data.

Find pdf file with input form

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.

How do I get the email value using the query string method?

I am using two plugins for Popup, window plugin and newsletter plugin. when popup shows, it displays the EMAIL field and Subscribe button
If customer enter the email and subscribe, the form action will redirect to Subscribe-page.php and the email value is returned from the poupup window
here is the code for popup window form
<form onsubmit="return newsletter_check(this)" action="http://www.example.com /subscription/" class="content-sxzw" method="post">
<input class="newsletter-email" type="email" placeholder="Your email here" name="ne" size="30" required>
<input type="submit" class="submit-sxzw" value="{{subscribe-button-text}}" />
</form>
Demo
How do I get the email to subscribe page using the query string method?
I think this is kind of basic jQuery stuff. You can get email by this code
var userEmail = $(".newsletter-email").val();

Multiple web service requests from single page in html

I am trying to submit three forms in single page. But I stuck at one point.
I want to make verification of mobile Number in first Form. then use that Mobile Number in final Form submission
I have tried using this in single Form but then How can I send web request for sending verification pin with verify Mobile Button.
I have Three forms like this,
//First Form Take Mobile Number, web service will send verification Pin as reply to this action
<form name="PhoneVerification" action="url to phone verification web service" >
Phone Number: <input type="text" name ="number" id="phone">
<input type="submit" name ="submit1" id="submit1">Verify Mibile Number</input>
</form>
//Second Form verifies pin Locally which is sent by first service
<form name="PinVerification" action="verify pin came from previous web service">
Verification Pin(Sent on Mobile Number): <input type="text" name ="pin" id="pin">
<input type="submit" name ="submit2" id="submit2">Verify Pin</input>
</form>
//Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
<form action="web service call to complete signup">
Email: <input type="text" name ="email" id="email">
Password: <input type="text" name ="pass" id="pass">
PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
<input type="submit" name ="submit3" id="submit3">Complete Signup</input>
</form>
The Problem is I am not able to get value of phone number as page is refreshed after that Form submission.
I read some threads about using AJAX , But How can I use Ajax in this type Of situation.
How can I achieve this. with AJAX, or using PHP.
Id must be unique in your html page. In above code id="phone" be present in first to forms. the second form in pinVerfication right but there is an same id = "phone" . please change it and make an another try. third form have also same problem
//Second Form verifies pin Locally which is sent by first service
<form name="PinVerification" action="verify pin">
Verification Pin(Sent on Mobile Number): <input type="text" name ="number" id="pin">
<input type="submit" name ="submit2" id="submit2">Verify Pin</input>
</form>
/Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
<form action="web service call to complete signup">
Email: <input type="text" name ="email" id="email">
Password: <input type="text" name ="pass" id="pass">
PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
<input type="submit" name ="submit3" id="submit3">Complete Signup</input>
</form>
You can use cookies or sessions to achieve this task.
if you want to do it with only javascript, you can use cookies. you can get the best reference from w3schools
You can do it with server side script like php and use ajax.
In this case you can use session.
First form submission store number in cookies or session. and in another form you get that value from cookie or session and make use of it.
Note: Don't forgot to delete cookies or session after you finish all work.

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"

Categories