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();
Related
I've got a Wordpress site with an inquiry form on its own page and it works fine just fine, but now the marketing people want us to put another form on the Homepage with just name and email address fields. When the user clicks "continue" (the submit button) the site needs to load the Inquiry Form page, with the Name and Email fields pre-filled using the data from the Homepage form.
I can't seem to find a relevant example here or elsewhere online that relates specifically to Wordpress.
Anyone know how to do this?
This answer requires some HTML and JavaScript knowledge. If your WordPress theme allows you to add custom HTML and JS to your pages then this will work for you.
First of all, create your homepage form and set the action attribute to the path of your inquiry form page. I'm assuming it's /inquiry.
<!-- On the home page -->
<form action="/inquiry">
<input type="name" name="email">
<input type="email" name="email">
<button>submit</button>
</form>
When a user fills this form and hits submit it will load your inquiry page and place the homepage form data in the URL as URL parameters (/inquiry?name=John&email=test%40domain.com)
Because the data we want is in the URL, we can use JavaScript to extract it and populate the inquiry form. Make sure that the JavaScript is placed after the form on the page.
<!-- on the inquiry page -->
<!-- form -->
<form id="inquiry">
<input type="text" name="name">
<input type="email" name="email">
<input type="text" name="phone">
<button>submit</button>
</form>
<!-- custom javascript -->
<script>
// Get the query parameters
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries())
// Set the query parameters to the relevant form inputs
if (params.name) {
// ⭐️ Adjust this selector to select your name field
document.querySelector('#inquiry [name="name"]').value = params.name
}
if (params.email) {
// ⭐️ Adjust this selector to select your email field
document.querySelector('#inquiry [name="email"]').value = params.email
}
</script>
I am new to WordPress and elementor. I have created a form and I have to perform some functions on button click.
The functions are like redirecting to different or validating some information.
I inserted the HTML code element in the section and created the form. But I am not clear where to write the function and how to call it.
Below is the HTML code
<input type="text" id="IMEI" name="IMEI" placeholder="Enter your IMEI here" class="textbox">
<input type="button" class="buttonchk" value="Check Phone">
<br>
<br>
Can someone please help
I have this question about why my form is not posting data to my PHP script. To unsubscribe from an emailing list I've set up, I send the user that has unsubscribed an email with a form that posts some data.
<html>
<body>
<div>
<p>This is a confirmation message to confirm that you unsubscribed from the sci-eng email list.</p>
<p>Click on the button below to confirm your unsubscription.</p>
<form id="unsubform">
<div class="form-in">
<input type="hidden" id="emailkey" name="emailkey" value="key">
<input type="hidden" id="email" name="email" value="email#domain.com">
<button class="btn" id="submit" type="submit" formaction="http://redlinks.ca/sci-eng/db/unsubscribe.php" formmethod="post">Unsubscribe</button>
</div>
</form>
</div>
</body>
</html>
When on the page that the form is POSTed to, I get the "no data" error that I have set up if there is no data in the $_POST["email"] variable. I have tried using var_dump($_POST), but that just returns with array(0) { } and that isn't working for me.
The thing that confuses me the most is when I copy the exact html from the email, and paste it into a blank page, when I click on submit/unsubscribe it posts the data just fine, and elsewhere on my site I have the exact same script, the only different being the formaction is without the /db in it. The page that one is sent to behaves how it should, showing the propper array of data instead of nothing. That's the only difference.
If it makes any difference, I use Thunderbird for Windows 10 as my email client.
Anyone who thinks they can help would be appreciated :)
Due to security issues forms are not supported and not recommended within emails. Most of email clients will warn the user of a risk or simply will disable it and it will not work, like in your case.
The best practice for enabling unsubscribing is by using a link. You can pass any requierd parameter for unsubscribing on the link, for example http://www.example.com/unsubscribe.php?usermail=mail#gmail.com.
TRY WITH:
<html>
<body>
<div>
<p>This is a confirmation message to confirm that you unsubscribed from the sci-eng email list.</p>
<p>Click on the button below to confirm your unsubscription.</p>
<form id="unsubform" action="http://redlinks.ca/sci-eng/db/unsubscribe.php" method="post">
<div class="form-in">
<input type="hidden" id="emailkey" name="emailkey" value="key">
<input type="hidden" id="email" name="email" value="email#domain.com">
<button class="btn" id="submit" type="submit">Unsubscribe</button>
</div>
</form>
</div>
</body>
</html>
IF you won't use POST method so how your form values could be posted to phpScript. Try the following code.
<html>
<body>
<div>
<p>This is a confirmation message to confirm that you unsubscribed
from the sci-eng email list.</p>
<p>Click on the button below to confirm your unsubscription.</p>
<form id="unsubform" method="POST" action="http://redlinks.ca/sci-eng/db/unsubscribe.php">
<div class="form-in">
<input type="hidden" id="emailkey" name="emailkey" value="key">
<input type="hidden" id="email" name="email" value="email#domain.com">
<button class="btn" id="submit" type="submit" >Unsubscribe</button>
</div>
</form>
</div>
</body>
The default method is GET, not POST; you need to specify
<form method="post" ...>
Maybe a link to this form hosted online might be a better idea; some mail clients do not support showing mails; and maybe more clients might refuse to submit or post them due to security concerns (e.g. webmail interfaces).
Do not send form for confirmation.Try these steps :
Generate unique encrypted key for those email who unsubscribe and store in database
Send confirmation link to particular user email with key as (http://domainurl/confirm.php?key=1533c67e5e70ae7439a9aa993d6a3393)
Now check key for corresponding email and unsubscribe and also remove key from database
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.
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.