(This are just some of my code for the HTML to cut it short), i don't get it why i can't get the value inputted by the user for the email while i can get values of others like NAME, PHONE, COMPANY etc. can you help me what's wrong? i'm a beginner so please try to be nice. THANK YOU
HTML:
<form action="contact_sendmail.php" method="post">
<label for="first name"> First Name *</label><br>
<input class="textbox" type=text autofocus id="Fname" name="Fname" maxlength="50"size="30" value="" required>
<br>
<label for="last name"> Last Name *</label><br>
<input class="textbox" type=text id="Lname" name="Lname" maxlength="50"size="30" value="" required>
<br>
<label for="email">Email * </label> <br>
<input class="textbox" type="text" id="email" maxlength="50"size="30" value="" required>
<input class="button" name="submit" type="submit" value="Submit">
MAIL FUNCTION:
<?php
if(isset($_POST['submit'])){
$msg = 'Name: '.$_POST['Lname'] .$_POST['Fname'] ." \n"
.'Email: '.$_POST['email'] ."\n"
.'Phone Number: '.$_POST['phone'] ."\n"
.'Company: '.$_POST['company'] ."\n"
.'Number of Employees: '.$_POST['employee_num'] ."\n"
.'Comment: '.$_POST['comment'] ;
mail('example#gmail.com', 'sample contact us Form', $msg);
?>
"<script>" alert('successfully sent'); "</script>"
<?php
}else {
header('location:contact.php');
exit(0);}
?>
Related
Hi I use https://formsubmit.co as form submit.
Formsubmit only returns one checkbox even if two or more checkboxes is checked.
<form action="https://formsubmit.co/info#enchuga.com" method="POST">
<input type="hidden" name="_subject" value="Snyggt!! Ny beställning av algos">
<input type="hidden" name="_next" value="https://enchuga.com/enchugacap/thanks.html">
Name: <br>
<input class="contactForm" type="text" name="Name" placeholder="Your name" required> <br>
<br>
Mail: <br>
<input class="contactForm" type="email" name="Email" placeholder="Email Address" required> <br>
<br>
Which trading algorithms do you want to order? <br>
<input type="checkbox" id="LosAngeles" name="Algo" value="LosAngeles">
<label for="LosAngeles" class="orderText"> Los Angeles 69€/year (699 SEK)</label><br>
<input type="checkbox" id="London" name="Algo" value="London">
<label for="London" class="orderText"> London 69€/year (699 SEK)</label><br>
<input type="checkbox" id="Paris" name="Algo" value="Paris">
<label for="Paris" class="orderText"> Paris 69€/year (699 SEK)</label><br>
<input type="checkbox" id="Berlin" name="Algo" value="Berlin">
<label for="Berlin" class="orderText"> Berlin 69€/year (699 SEK)</label><br>
<input type="checkbox" id="NewYork" name="Algo" value="NewYork">
<label for="NewYork" class="orderText"> New York 69€/year (699 SEK)</label><br>
<input type="checkbox" id="allAlgos" name="Algo" value="allAlgos">
<label for="allAlgos" class="orderText"> All five algos 260€/year (2600 SEK, 25% discount)</label><br>
<br>
Send a message to enchuga CAPITAL if you wondering about anything or want to ask a question: <br>
<input class="contactForm2" type="text" name="Message"> <br>
<br>
<button type="submit">Send</button>
</form>
How do I get it to return every checkbox checked?
I have tried to create checkboxes that returns the item they checked but I don't get it to work.
I am importing a form written in GoogleApps Script into an iframe on a page built with Squarespace but for the life of me cannot prevent the form from submitting. I am using:
window.addEventListener( 'load', preventFormSubmit );
as suggested in GAS documentation but this does not seem to be triggering the preventFormSubmit function. Instead, when the submit button is clicked the form submits and goes to a blank google page. Also the alerts in the preventFormSubmit function (now commented out) never display which suggests that the form is never called.
I have spent days on this, cannot find an answer anywhere and can no longer see the woods for the trees. Any clues as to what I am doing wrong?
Squarespace is a website builder which enables one to embed code, in this case as an iframe.
My code:
js.html:
<script>
function preventFormSubmit() {
//alert( "prevent form submit triggered" );
var forms = document.querySelectorAll('form');
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener('submit', function(event) {
event.preventDefault();
});
}
//alert( "forms prevented from submitting: " = forms.length );
}
window.addEventListener( "ready", preventFormSubmit );
function handleFormSubmit(formObject) {
google.script.run
.withSuccessHandler( showSuccess )
.withFailureHandler( showError )
.processForm_1( formObject );
}
</script>
html:
<!DOCTYPE html >
<head>
<base target="_top" >
<?!= include('css'); ?>
<?!= include('js'); ?>
</head>
<body>
<div id="formDiv" class="card" >
<h2 id="title" >Alternative Booking form</h2>
<form id="alternative-booking-form-1" onsubmit="handleFormSubmit(this)" >
<fieldset>
<legend>About You</legend>
<p>Please tell us a bit about yourself.
</p>
<input type="text" id="firstName" name="firstName" form="alternative-booking-form-1"
placeholder="your first name" value="" required
/><br />
<input type="text" id="lastName" name="lastName" form="alternative-booking-form-1"
placeholder="your last name" value="" required
/><br />
<input type="text" id="title" name="title" form="alternative-booking-form-1"
placeholder="your title, eg: mr, mrs, ms etc" value="" /><br>
</fieldset>
<fieldset>
<legend>Your Contact Details</legend>
<p>We will only use your contact details in case we need to contact you with regard to
this booking, unless you consent
to further communications, as offered later in this booking process.</p>
<input type="email" id="email" name="email" form="alternative-booking-form-1"
placeholder="your email address" value=""
required /><br />
<input type="tel" id="phone" name="phone" form="alternative-booking-form-1"
placeholder="phone" value="" required /><br />
</fieldset>
<fieldset>
<input type="hidden" id="form" name="form" form="alternative-booking-form-1" value="1" />
<br />
<input type="submit" id="submit" name="submit" form="alternative-booking-form-1"
class="red" value="Next →" />
<br />
<br />
</fieldset>
</form>
</div>
<div id="output" name="output" ></div>
</body>
<!DOCTYPE html >
<head>
<base target="_top" >
<?!= include('css'); ?>
<?!= include('js'); ?>
</head>
<body>
<div id="formDiv" class="card" >
<h2 id="title" >Alternative Booking form</h2>
<form id="alternative-booking-form-1" >
<fieldset>
<legend>About You</legend>
<p>Please tell us a bit about yourself.
</p>
<input type="text" id="firstName" name="firstName" form="alternative-booking-form-1"
placeholder="your first name" value="" required
/><br />
<input type="text" id="lastName" name="lastName" form="alternative-booking-form-1"
placeholder="your last name" value="" required
/><br />
<input type="text" id="title" name="title" form="alternative-booking-form-1"
placeholder="your title, eg: mr, mrs, ms etc" value="" /><br>
</fieldset>
<fieldset>
<legend>Your Contact Details</legend>
<p>We will only use your contact details in case we need to contact you with regard to
this booking, unless you consent
to further communications, as offered later in this booking process.</p>
<input type="email" id="email" name="email" form="alternative-booking-form-1"
placeholder="your email address" value=""
required /><br />
<input type="tel" id="phone" name="phone" form="alternative-booking-form-1"
placeholder="phone" value="" required /><br />
</fieldset>
<fieldset>
<input type="hidden" id="form" name="form" form="alternative-booking-form-1" value="1" />
<br />
<input type="button" id="submit" name="submit" form="alternative-booking-form-1"
class="red" value="Next →" />
<br />
<br />
</fieldset>
</form>
</div>
<div id="output" name="output" ></div>
<script>
window.onload = function() {
document.getElementById("alternative-booking-form-1").addEventListener( "ready", handleFormSubmit );
}
function handleFormSubmit(formObject) {
google.script.run
.withSuccessHandler( showSuccess )
.withFailureHandler( showError )
.processForm_1( formObject );
}
</script>
</body>
hey here is the code whenever my site is converted into the mobile view then mailto function is not working? can anyone suggest to me a solution to how he is works in mobile-view?
<form id="myForm" action="mailto:syedali6097#gmail.com" method="post" enctype="text/plain">
<h2>Win</h2>
<input name="name" type="text" placeholder="Enter Name">
<br><br>
<input name="subject" type="text" placeholder=" Subject">
<br><br>
<!-- <label>Email:-</label> -->
<input name="email" type="text" placeholder="Enter Email">
<br><br>
<input name="number" type="number" placeholder=" Enter Phone Number">
<br><br>
<p class="text-center">Fave Vape Flavour:-</p>
<textarea type="text" name="Description" size="50" rows="5" placeholder="Type Message"></textarea>
<br><br>
<input type="submit" value="Send" onclick="myFunction()">
<input type="reset" value="Reset">
</form>
I need some help with my login form. On every browser I am able to login except Safari 8.
<form action="index.php?mod=users&do=login" name="frm" id="frm" class="rf" method="post">
<label for="email">Email</label>
<input type="email" id="email" name="email" value="<?php Outtext($frmdata['email']); ?>" class="rfield"><br>
<div class="verror"><?php if($error['email']!='') Outtext($error['email']); ?></div>
<br>
<label for="password">Passwort</label>
<input type="password" id="password" name="password" value="" class="rfield"><br>
<div class="verror"><?php if($error['password']!='') Outtext($error['password']); ?></div>
<br>
<button name="login" class="login-button button">Login</button><br>
<span style="color:#030303">Passwort</span> vergessen?
<a class="registerButton" href="#">Registrieren?</a>
<a class="manager_loginButton" href="#"><span style="color:#030303">Studiomanager</span> Login</a>
<input type="hidden" name="redirect_to" value="<?php echo($_SERVER['REQUEST_URI']); ?>">
</form>
This one worked for me:
<input type="hidden" name="login" value="login">
Right under the other
<input type=hidden>
tag.
I have this Perl script that I didn't write (nor can I write Perl), inserts a logout link if you're logged in:
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = 'LogoutMy Account';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
Home
Who's online?
Highscores
Rules
About
Guilds
Houses
Donations
Forum
Lost Password
Create Account$addlink
<div id="menufooter"></div>
};
if (!$logged_in_as) {
&print_loginform();
}
$web_content .= "</div>";
Would there be a way to add some inline css when the user is logged in to do something really hacky and just display:none the loginpanel?
I tried this:
if ($logged_in_as) {
$addlink = 'LogoutMy Account';
$removelogin = '<style type="text/css" media="screen">.loginpanel:display:none;</style>';
}
Safe to say it didn't work but since I'm not a Perl programmer I can't really figure this out, this is a total shot in the dark for me, and I feel like a bit of noob for even coming and asking for help.
The documentation I tried to find on Perl was sparse at best too.
Here's Mathew's code, this doesn't work (probably my fault)
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = 'LogoutMy Account';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
Home
Who's online?
Highscores
Rules
About RealOTS
Guilds
Houses
Donations
Forum
Lost Password
Create Account$addlink
<div id="menufooter"></div>
<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
<form method="POST" action="/character/">
<input type="hidden" name="page" value="character">
Character Search<input type="text" name="searchchar" value="" size=15><br><br>
<input type="submit" value="Look up">
</form>
};
if (!$logged_in_as) {
&print_loginform();
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
};
}
$web_content .= "</div>";
Well that's not correct css:
<style type="text/css" media="screen">.loginpanel{display:none;}</style>
You might also consider putting the login panel
<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
below this line
if (!$logged_in_as) {
&print_loginform();
like so:
if (!$logged_in_as) {
&print_loginform();
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
};
}
now remove this chunk:
<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
only the one that appears below:
<div id="menufooter"></div>
and finally reverse this part:
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
};
&print_loginform();
though at this point you might as well remove print_loginform...
Instead of hacking the css, maybe you can modify $webcontent.
if ($logged_in_as) {
$addlink = 'LogoutMy Account';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
Home
Who's online?
Highscores
Rules
About RealOTS
Guilds
Houses
Donations
Forum
Lost Password
Create Account$addlink
<div id="menufooter"></div>
};
if (!$logged_in_as) {
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</form></div>
};
}
$web_content .= "</div>";
I think you can omit the print_loginform function