I have Form Like this. I wanted to Save this form Data in my Google Drive (Google Spreadsheet) using Core Php
<div class="form">
<div class="tab-content">
<div id="signup">
<h1>Sign Up for Free</h1>
<form action="/" method="post">
<div class="top-row">
<div class="field-wrap">
<label>
First Name<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" />
</div>
<div class="field-wrap">
<label>
Last Name<span class="req">*</span>
</label>
<input type="text"required autocomplete="off"/>
</div>
</div>
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email"required autocomplete="off"/>
</div>
<button type="submit" class="button button-block"/>Submit</button>
</form>
</div>
</div>
<!-- tab-content -->
</div>
<!-- /form -->
How can I do that?
You can use the below link
http://farinspace.com/2009/05/saving-form-data-to-google-spreadsheets/
and it is worked for me
Related
Recently I got the SSl Certificate and got installed , every thing later seems to be working fine but one file(index1.php) doesn,t work correctly and the file works only on http not on https
the tab Signup(#Signup) is not showing up only(#sigin) is working (in the case of using .) but working perfectly when using (http://.. )and I could not see any mistake.here is my php file:
<?php /* Main page with two forms: sign up and log in */
require 'db.php';
session_start();?>
<!DOCTYPE html><html><head> <title>Sign-Up/Login Form</title>
<?php include 'css/css.html'; ?></head>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
if (isset($_POST['login'])) { //user logging in
require 'login.php';
}
elseif (isset($_POST['register'])) { //user registering
require 'register.php'; }}?>
<body> <div class="form">
<ul class="tab-group">
<li class="tab">Sign Up</li>
<li class="tab active">Log In</li>
</ul>
<div class="tab-content">
<div id="login">
<h1>Welcome Back!</h1>
<form action="index1.php" method="post" autocomplete="off">
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email" required autocomplete="off" name="email"/>
</div>
<div class="field-wrap">
<label>
Password<span class="req">*</span>
</label>
<input type="password" required autocomplete="off" name="password"/>
</div>
<p class="forgot">Forgot Password?</p>
<button class="button button-block" name="login" />Log In</button>
</form>
</div>
<div id="signup">
<h1>Sign Up for Free</h1>
<form action="index1.php" method="post" autocomplete="off">
<div class="top-row">
<div class="field-wrap">
<label>
First Name<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name='firstname' />
</div>
<div class="field-wrap">
<label>
Last Name<span class="req">*</span>
</label>
<input type="text"required autocomplete="off" name='lastname' />
</div>
</div>
<div class="top-row">
<div class="field-wrap">
<label>
City <span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name='City' />
</div>
<div class="field-wrap">
<label>
Postal<span class="req">*</span>
</label>
<input type="text"required autocomplete="off" name='Postal' />
</div>
</div>
<div class="top-row">
<div class="field-wrap">
<label>
Street<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name='Street' />
</div>
<div class="field-wrap">
<label>
buildingNo<span class="req">*</span>
</label>
<input type="text"required autocomplete="off" name='buildingNo' />
</div>
</div>
<div class="top-row">
<div class="field-wrap">
<label>
phone<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name='phone' />
</div>
<div class="field-wrap">
<label>
Room (if any)
</label>
<input type="text"notrequired autocomplete="off" name='noteadress' />
</div>
</div>
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email"required autocomplete="off" name='email' />
</div>
<div class="field-wrap">
<label>
Set A Password<span class="req">*</span>
</label>
<input type="password"required autocomplete="off" name='password'/>
</div>
<div class="field-wrap">
<h3 style="color:green"> By clicking Register, you agree to our Terms and that you have read our <span>Data Use Policy</span>, including our Cookie Use</h3>
</div>
<button type="submit" class="button button-block" name="register" />Register</button>
</form>
</div>
</div><!-- tab-content -->
</div> <!-- /form -->
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
Might try changing:
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
To:
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
If simply changing the http to https doesn't work, you will need to find the https version of the link.
I am trying to shift my radio button to the right for this certain part for a long time and it still doesn't work, I try using padding and class col-md for it and even check if my tag are closed but it is still not moving to the right. Can anybody help me with this problem? Thanks in advance.
test.blade.php
<div class="form-group">
<label class="col-md-2"><b>Residential Status:</b></label>
<div class="col-md-8">
<input type="radio" name="residential_status" value="Local" required> Local<br>
<input type="radio" name="residential_status" value="Overseas" required> Overseas<br>
</div>
</div>
<div class="form-group">
<div class="editfield1">
<div class="radio">
<div id="chkNRICid1">
<label style="font-weight: bold">Do you have a NRIC?</label> <br/>
<input type="radio" name="NRIC_check" id="nricid1" value="Yes" onclick="document.getElementById('NRIC_check').style.display='block'" required> Yes <br>
<input type="radio" name="NRIC_check" id="nricid2" value="No" onclick="document.getElementById('NRIC_check').style.display='none'" required> No
</div>
</div>
</div>
<div class="editfield1" id="NRIC_check" style="display:none">
<label for="NRIC_check"> Type your NRIC/FIN number:</label>
<label><input type="text" name="nric_number1" id="nric_number1"> </label>
</div>
</div>
This is the screenshot of what is happening: (I want it to be like the Residential Status)
So many wayward and un-needed divs you can get rid of along with fixing your nesting, after that it's just a matter of following the structure in the first part of your template:
<div class="form-group">
<div class="col-md-2">
<label>Residential Status</label>
</div>
<div class="col-md-10">
<label><input type="radio" name="residential_status" value="Local" required> Local</label>
<br />
<label><input type="radio" name="residential_status" value="Overseas" required> Overseas</label>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label>Do you have a NRIC?</label>
</div>
<div class="col-md-10">
<label><input type="radio" name="NRIC_check" id="nricid1" value="Yes" onclick="document.getElementById('NRIC_check').style.display='block'" required>Yes</label>
<br />
<label><input type="radio" name="NRIC_check" id="nricid2" value="No" onclick="document.getElementById('NRIC_check').style.display='none'" required> No </label>
</div>
</div>
<div class="form-group" id="NRIC_check" style="display:none">
<div class="col-md-2">
<label>Type your NRIC/FIN number:</label>
</div>
<div class="col-md-10">
<input type="text" name="nric_number1" id="nric_number1" />
</div>
</div>
Wrap the two inputs inside a <div> and add some margin.
<div style="margin-left: 50px">
<input ... />
<input ... />
</div>
If you are using Bootstrap 4 you could even:
<div class="ml-5">
I am making a get started button on my website, where the person enters his email and then presses "get started". The text should then be transferred to my login page in the email field.
Here is my code for the button:
<form method="post" action="#" class="container 50%">
<div class="row uniform 50%">
<div class="8u 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="Your Email Address" /></div>
<div class="4u$ 12u$(xsmall)"><input type="button" value="Get Started" class="fit special" onclick="location.href='loginsystem/loginpage.php';"></div>
</div>
</form>
And here is my code for the login page:
<?php
/* Main page with two forms: sign up and log in */
require 'db.php';
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign-Up/Login Form</title>
<?php include 'css/css.html'; ?>
</head>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['login'])) { //user logging in
require 'login.php';
}
elseif (isset($_POST['register'])) { //user registering
require 'register.php';
}
}
?>
<body style="background-color: #1c1d26">
<div class="form">
<ul class="tab-group">
<li class="tab">Sign Up</li>
<li class="tab active">Log In</li>
</ul>
<div class="tab-content">
<div id="login">
<h1>Welcome Back!</h1>
<form action="loginpage.php" method="post" autocomplete="off">
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email" required autocomplete="off" name="email"/>
</div>
<div class="field-wrap">
<label>
Password<span class="req">*</span>
</label>
<input type="password" required autocomplete="off" name="password"/>
</div>
<p class="forgot">Forgot Password?</p>
<button class="button button-block" name="login" />Log In</button>
</form>
</div>
<div id="signup">
<h1>Sign Up for Free</h1>
<form action="loginpage.php" method="post" autocomplete="off">
<div class="top-row">
<div class="field-wrap">
<label>
First Name<span class="req">*</span>
</label>
<input type="text" required autocomplete="off" name='firstname' />
</div>
<div class="field-wrap">
<label>
Last Name<span class="req">*</span>
</label>
<input type="text"required autocomplete="off" name='lastname' />
</div>
</div>
<div class="field-wrap">
<label>
Email Address<span class="req">*</span>
</label>
<input type="email"required autocomplete="off" name='email' />
</div>
<div class="field-wrap">
<label>
Set A Password<span class="req">*</span>
</label>
<input type="password"required autocomplete="off" name='password'/>
</div>
<button type="submit" class="button button-block" name="register" />Register</button>
</form>
</div>
</div><!-- tab-content -->
</div> <!-- /form -->
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'> </script>
<script src="js/index.js"></script>
</body>
</html>
Thank you!
In your get started form set action="yourLoginPage.php"
<form method="post" action="yourLoginPage.php" class="container 50%">
In your login page
<input type="email" required autocomplete="off" name="email" value="<?php echo $_POST["email"]; ?>"/>
I'm trying to submit data to a list in my mail chimp but also allow the user to upload a file.
Here is my code, the first chunk is the mailchimp autogenerated form which is submitted via:
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
and then it's followed by the basic code to submit a file. But at the moment both functions have a submit button. I want only one. Can anyone help?
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://test.us7.list-manage.com/subscribe/post?u=d12b70d4bb1e08c1568d5b392&id=bfb41cbf75" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</form>
</form>
</body>
You could accomplish this by routing the MailChimp information through your upload_file.php file.
MailChimp has a great API that you can use for more than just adding a subscriber to a list. You would specifically want the listSubscribe() function. There are some great examples on that page.
Here's more documentation on MailChimp's API: http://apidocs.mailchimp.com/api/2.0/
So in your HTML, you would want to remove the second submit button and make it one form with action="upload_file.php". The PHP file would upload the file, then use the API to submit the data to MailChimp.
You html should look like this:
<body>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<h2>Subscribe to our test mailing list</h2>
<div class="indicates-required">
<span class="asterisk">*</span> indicates required
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">
Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name </label>
<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last Name </label>
<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group input-group">
<strong>Interests </strong>
<ul>
<li><input type="checkbox" value="1" name="group[5597][1]" id="mce-group[5597]-5597-0"><label for="mce-group[5597]-5597-0">Interest 1</label></li>
<li><input type="checkbox" value="2" name="group[5597][2]" id="mce-group[5597]-5597-1"> <label for="mce-group[5597]-5597-1">Interest 2</label></li>
<li><input type="checkbox" value="4" name="group[5597][4]" id="mce-group[5597]-5597-2"><label for="mce-group[5597]-5597-2">Interest 3</label></li>
</ul>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</div>
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</body>
Here's a form I have. I want to post the form entries to the same page and then do something else with it. However, echoing the values doesn't seem to be working. What am I doing wrong?
Here's the HTML part:
<div class="well">
<form name="myform" class="form-horizontal" id="form" onsubmit="return validateForm(this);" action="my.php" method="post">
<div class="control-group input-append">
<label for="text" class="control-label">Field1</label>
<div class="controls">
<div class="left">
<input id="Field1" name="Field1" type="text"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="passwd" class="control-label">Field2</label>
<div class="controls">
<div class="left1">
<input id="Field2" name="Field2" type="password" />
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="passwd" class="control-label">Field3</label>
<div class="controls">
<div class="left1">
<input id="Field3" name="Field3" type="password"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="select" class="control-label">Field4</label>
<div class="controls">
<div class="left1">
<select class="form-control" name="Field4">
<option value="OP1">OP1</option>
<option value="OP2">OP2</option>
<option value="OP3">OP3</option>
<option value="OP4">OP4</option>
</select>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="text" class="control-label">Field5</label>
<div class="controls">
<div class="left">
<input type="Field5" id="Field5" name="type"/>
</div>
</div>
</div>
<br>
<div class="control-group input-append">
<label for="text" class="control-label">Field6</label>
<div class="controls">
<div class="left">
<input type="text" id="Field6" name="Field6"/>
</div>
</div>
</div>
<br>
<div class="control-group">
<div class="controls">
<div class="left1">
<input type="submit" class="btn btn-success"/>
</div>
</div>
</div>
</form>
</div>
PHP part:
<?php
if (isset($_POST['submit']))
{
echo $_POST['name'];
} else {?>
<?php;}?>
There is no field with the name $_POST['name'], though you have fields with numbered names, e.g. $_POST['Fields3'].
To debug the form request print out the whole $_POST array first:
var_dump( $_POST );
The type of an input is not the same as it's name!
Another option is to replace
if (isset($_POST['submit']))
with:
if($_SERVER['REQUEST_METHOD'] == 'POST')
Replace <input type="submit" class="btn btn-success"/>
to <input type="submit" name="submit" class="btn btn-success"/>
The problem is here:
if (isset($_POST['submit']))
Your submit button
<input type="submit" class="btn btn-success" />
does not have a value, nor does it have a name. Post works with these attributes:
$_POST['<name>'] = <value>
change your input to
<input type="submit" name="submit" value="Submit" class="btn btn-success" />
Btw, nice to see people still coding in XHTML. If you are using HTML 5, you should not end your non-closing tags with a slash ... />.