I'm trying to create a form on a Cargo site, but they don't allow anywhere for .php files. I want the form to send an email to me upon the "submit" button being clicked. "mailto:" doesn't work, by the way.
Here's the form right now. I've tried adding an action to the form, but obviously I can't link a .php file:
<form>
<ul class="form-style-1">
<li><label>Full Name <span class="required">*</span></label><input type="text" name="field1" class="field-divided" placeholder="First"> <input type="text" name="field2" class="field-divided" placeholder="Last"></li>
<li>
<label>Email <span class="required">*</span></label>
<input type="email" name="field3" class="field-long">
</li>
<li>
<label>Subject</label>
<select name="field4" class="field-select">
<option value="Advertise">Advertise</option>
<option value="Partnership">Partnership</option>
<option value="General Question">General</option>
</select>
</li>
<li>
<label>Your Message <span class="required">*</span></label>
<textarea name="field5" id="field5" class="field-long field-textarea"></textarea>
</li>
<li>
<input type="submit" value="Submit">
</li>
</ul>
</form>
If anyone could suggest a workaround, I'd be so grateful!
Related
I have a standard PHP web form with text fields, dropdowns, and radio buttons. When the form is submitted, the submitted information is e-mailed to me. I want to add a multiple choice question with checkboxes. I can produce the form field, but I can't figure out how to include multiple selections for that one question on the e-mail that gets sent when the form is submitted. Ideally, I would like to have the multiple selections on one line and separated by semi-colons (or commas if that's easier)
I've included what I think are the relevant parts of the code. Apologies if I didn't format this post correctly.
<form action="example.php" method="post" autocomplete="off">
<div class="form-row">
<label for="first">
<span>First Name:</span>
<input type="text" id="first" name="first" autocomplete="off" list="autocompleteOff">
</label>
</div>
<div class="form-row">
<label for="last">
<span>Last Name:</span>
<input type="text" id="last" name="last" autocomplete="off" list="autocompleteOff">
</label>
</div>
<div class="form-row">
<label for="email">
<span>E-mail:</span>
<input type="text" id="email" name="email" autocomplete="off" list="autocompleteOff">
</label>
</div>
<div class="form-row-multiple">
<label for="multiple">
<span>Choose all that apply:</span><br>
<input type="checkbox" name="multiple" id="multiple" value="Option 1"><span>Option 1</span>
<input type="checkbox" name="multiple" id="multiple" value="Option 2"><span>Option 2</span>
<input type="checkbox" name="multiple" id="multiple" value="Option 3"><span>Option 3</span>
<input type="checkbox" name="multiple" id="multiple" value="Option 4"><span>Option 4</span> </label>
</div>
<div class="form-row">
<button type="submit" name="submit" id="submit"><b>Submit</b></button>
</div>
</form>
<?php
$first = remove_headers($_POST['first']);
$last = remove_headers($_POST['last']);
$email = remove_headers($_POST['email']);
$multiple = remove_headers($_POST['multiple']);
$message =
"First: $first\n\n" .
"Last: $last\n\n"
"E-mail: $email\n\n"
"Multiple: $multiple\n\n"
Two things to do here,
For multiple checkboxes use the name attribute as an array and remove the id attribute, as an HTML page should have a unique ID throughout.
<input type="checkbox" name="multiple[]" value="Option 1"><span>Option 1</span>
<input type="checkbox" name="multiple[]" value="Option 2"><span>Option 2</span>
<input type="checkbox" name="multiple[]" value="Option 3"><span>Option 3</span>
<input type="checkbox" name="multiple[]" value="Option 4"><span>Option 4</span>
When the form is submitted, multi-valued checkboxes are received as an array. So, we can make it semicolon-separated using the implode() function.
$multiple = implode(';', $_POST['multiple']);
I am trying to follow along here in my book when building my website, I am trying to work on PHP/ .pl form saving, but I cannot seem to get it to work like it should.
<form action="/cgi-bin/contactlist.php" method="post">
<fieldset>
<legend>Join E-mail List Test blah blah</legend>
<p>This is a test and I am curious what it does so lol </p>
<ol>
<li>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</li>
<li>
<label for="email">Email:</label>
<input type="text`enter code here`" name="email" id="email" />
</li>
</ol>
<input type="submit" value="Submit" />
</fieldset>
</form>
</body>
</html>
The code listed above, but the form is not saving like it should, any suggestions?
I purchased subscription addon from here, but its not working I have successfully installed it and its showing in my admin panel but when i write below code its not showing anything to me on my page.
{exp:subs:subscribe register_member="yes" plan="{segment_3}" payment_method="stripe" return="/account/subscription/%SUBS_HASH%"}
<h1>Subscribe to: {subs:plan:label}</h1>
<p>
Every <strong>{subs:plan:recurring_interval_count} {subs:plan:recurring_interval}</strong> {subs:plan:recurring_amount} {subs:plan:currency}
</p>
<hr>
{if subs:total_errors}
<ul class="errors">
{subs:form_errors}
<li>{subs:error}</li>
{/subs:form_errors}
</ul>
{/if}
<h3>Credit Card</h3>
<label>Credit Card Number</label>
<input name="card_number" type="text" value="{subs:card_number}">
<label>Name on card</label>
<input name="card_name" type="text" value="{subs:card_name}">
<label>Expires</label>
<select name="card_exp_month">{subs:month_options}</select>
<select name="card_exp_year">{subs:year_options}</select>
<label>Security Code</label>
<input name="card_cvc" type="text" value="{subs:card_cvc}" size="5">
<button type="submit">Subscribe</button>
{/exp:subs:subscribe}
I used their example code you can find it here.
please help me thanks in advance.
Your page is showing blank because page is not getting {segment_3} i.e. plan i hope you have not create any plan or if created then you have not passed them as {segment_3}. To test this thing use below code it will be helpful for you.
{exp:subs:subscribe register_member="yes" plan="gold" payment_method="stripe" return="/account/"}
<h1>Subscribe to: {subs:plan:label}</h1>
<p>
Every <strong>{subs:plan:recurring_interval_count} {subs:plan:recurring_interval}</strong> {subs:plan:recurring_amount} {subs:plan:currency}
</p>
<hr>
{if subs:total_errors}
<ul class="errors">
{subs:form_errors}
<li>{subs:error}</li>
{/subs:form_errors}
</ul>
{/if}
{if logged_out}
<h3>User Account</h3>
<label>Username</label>
<input type="text" name="username" value="">
<label>Email</label>
<input type="text" name="email" value="">
<label>Password</label>
<input type="password" name="password" value="">
<label>Password Confirm</label>
<input type="password" name="password_confirm" value="">
{/if}
<h3>Credit Card</h3>
<label>Credit Card Number</label>
<input name="card_number" type="text" value="{subs:card_number}">
<label>Name on card</label>
<input name="card_name" type="text" value="{subs:card_name}">
<label>Expires</label>
<select name="card_exp_month">{subs:month_options}</select>
<select name="card_exp_year">{subs:year_options}</select>
<label>Security Code</label>
<input name="card_cvc" type="text" value="{subs:card_cvc}" size="5">
<button type="submit">Subscribe</button>
{/exp:subs:subscribe}
make a plan named gold or abc whatever you want must put the same name at plan="plan_name" at the first line you can see it and remember for Visa cards it requires some more fields you may get fields error for this you have to use that fields you can find those fields on devdemon website.
enjoy !!!
This isthe form which i am submitting it through on click on text, but the values are not passing on the action page.
<form action="forget_pass.php" method="post" id="new_user" name="new_user">
<ul class="inputlist">
<li><span class="redcolor">*</span>Email Address or Phone No.</li>
<li>
<input name="" class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
</li>
<li class="rightalign">
<a href="javascript:document.new_user.submit();" onclick="">
Retrieve Password</a></li>
</form>
<input name="" class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
Should be
<input class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
-
<a href="javascript:document.new_user.submit();" onclick="">
should be better to be
<a href="#" onclick="document.new_user.submit();return false;">
here is the working code you can use
<form action="forget_pass.php" method="post" id="new_user" name="new_user">
<ul class="inputlist">
<li><span class="redcolor">*</span>Email Address or Phone No.</li>
<li>
<input class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
</li>
<li class="rightalign">
<a href="javascript:document.new_user.submit();">
Retrieve Password</a></li>
</form>
Problems in your code are
1- you have two name attributes. one is empty
2- onclick not used properly...
Hope it helps
You should try this code,
<form action="forget_pass.php" method="post" id="new_user" name="new_user">
<ul class="inputlist">
<li><span class="redcolor">*</span>Email Address or Phone No.</li>
<li>
<input class="inputbox" type="text" name="emailAddress" id="txtEmail" >
</li>
<li class="rightalign">
<a href="javascript:submitForm();">
Retrieve Password</a></li>
</ul>
</form>
And the javaScript code is,
submitForm = function(){
alert(document.forms[0].emailAddress.value);
document.forms[0].submit();
}
And the running code is this http://jsfiddle.net/4AWW6/
I have set up a PHP form for a competition for users to enter all information to be stored in a database. I used a NetTut+ tutorial to do so.
I've got the form submitting to the database as required, but with so many additional questions being asked, I would like to split the form into two separate sections. Obviously the first page would say continue to the next step before the second step allowing for the form to be submitted to the database.
The content that the user sees should be split, but should all be a part of the same form. Step 1 > Step 2 before submission.
Would anyone know of or recommend any methods to do this?
I've attached the code below.
<form method="post" action="">
<fieldset>
<ul>
<li>
<label for="code">Entry Code On-Pack</label>
<input type="text" name="code" />
</li>
<li>
<label for="name">Name</label>
<input type="text" name="name" />
</li>
<li>
<label for="email">Email</label>
<input type="text" name="email" />
</li>
<li>
<label for="addressone">Address</label>
<input type="text" name="addressone" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addresstwo" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addressthree" />
</li>
<li>
<label for="telephone">Telephone</label>
<input type="text" name="telephone" />
</li>
<li>
<label for="dob">Date of Birth</label>
<input name="dob" type="text" value="[dd/mm/yy]" />
</li>
<li>
<label for="q1">Where have you seen Cookstown advertised?</label><br />
<input type="checkbox" name="q1cb1" /><label for="q1cb1">Magazines</label><br />
<input type="checkbox" name="q1cb2" /><label for="q1cb2">Billboards</label><br />
<input type="checkbox" name="q1cb3" /><label for="q1cb3">Television</label><br />
<input type="checkbox" name="q1cb4" /><label for="q1cb4">Radio</label><br />
<input type="checkbox" name="q1cb5" /><label for="q1cb5">Online</label><br />
<input type="checkbox" name="q1cb6" /><label for="q1cb6">Public Transport</label><br />
<input type="checkbox" name="q1cb7" /><label for="q1cb7">Bus Stops</label><br />
</li>
<li>
<label for="q2">How well do you remember those advertisments?</label><br />
<input type="radio" name="q2" value="VeryWell"/><label for="q1cb1">Very well</label><br />
<input type="radio" name="q2" value="FairlyWell"/><label for="q1cb2">Fairly well</label><br />
<input type="radio" name="q2" value="FewDetails"/><label for="q1cb3">A few details</label><br />
<input type="radio" name="q2" value="NotAtAll"/><label for="q1cb4">Not at all</label><br />
</li>
<label for="tc">Do you accept the terms and conditions</label>
<input type="checkbox" name="tc" class="styled" />
</li>
<li> </li>
<li>
<input type="submit" value="Enter Competition" class="large blue button" name="signup" />
</li>
</ul>
</fieldset>
</form>
Use sessions mechanism to store 1 step data
You could pass them to page two and then put them in as hidden variables. You could also use session variables.
example with hidden fields
Sessions are usually the preferred way to do this, but hidden form fields would work just as well.
It's pretty easy to do - after the first submission, store the values into the session - validate them first if you like, it's probably a good idea to do so in fact. Then go to the next page, and once submitted, validate the second bunch of answers and put them into the database.
Hidden form fields work too, but I prefer the session-based approach.
Good luck!
One other option would be to put the additional fields in a hidden div on the same page and use javascript to show them once the first set have been completed. The advantage for you is that it keeps your form processing simpler. Also for your users, they won't have a round trip to the server to get the other part of the form.
This, of course, requires that your users have javascript turned on. The best practice would be to show all fields on the same page by default, and then use JS to hide the second batch before the page renders.