javascript - Get status from checkbox with PHP and Bootstrap CSS -


i trying create contact form using php , bootstraps css. got of things working, need status multiple checkboxes , post "labels" checked boxes in mail. know doesn't work simple , i've seen online pages using javascript or ajax etc. can't working, page:

--update--

thank answer once again still getting 500 error page: http://prntscr.com/6u21xy

<?php if(isset($_post['submit']))  {  $message= 'full name:	'.$_post['fullname'].'<br /> subject:	'.$_post['subject'].'<br /> phone:	'.$_post['phone'].'<br />  foreach($_post['check_list'] $check) { $message .= .$check . '<br>';        }   email:	'.$_post['emailid'].'<br /> comments:	'.$_post['comments'].' ';     require "phpmailer-master/class.phpmailer.php"; //include phpmailer class            // instantiate class       $mail = new phpmailer();              // set smtp       $mail->issmtp();                // sets smtp connection       $mail->smtpauth = true;         // connection smtp require authorization         $mail->smtpsecure = "ssl";      // connect using tls connection       $mail->host = "smtp.gmail.com";  //gmail smtp server address     $mail->port = 465;  //gmail smtp port     $mail->encoding = '7bit';          // authentication       $mail->username   = "example@gmail.com"; // full gmail address     $mail->password   = "examplepassword"; // gmail password            // compose     $mail->setfrom($_post['emailid'], $_post['fullname']);     $mail->addreplyto($_post['emailid'], $_post['fullname']);     $mail->subject = "new contact form enquiry";      // subject (which isn't required)       $mail->msghtml($message);       // send       $mail->addaddress("examplereceiver@gmail.com", "mr. example"); // send - recipient     $result = $mail->send();		// send!   	$message = $result ? '<div class="alert alert-success" role="alert"><strong>success!</strong>message sent successfully!</div>' : '<div class="alert alert-danger" role="alert"><strong>error!</strong>there problem delivering message.</div>';    	unset($mail);  } ?> <!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title>contact form</title>      <!-- bootstrap -->     <link href="css/bootstrap.min.css" rel="stylesheet">     <link rel="stylesheet" href="css/style.css">      <!-- html5 shim , respond.js ie8 support of html5 elements , media queries -->     <!-- warning: respond.js doesn't work if view page via file:// -->     <!--[if lt ie 9]>       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>     <![endif]-->   </head>   <body>   	<div class="contactform">   	<div class="panel panel-default">   		<div class="panel-heading">     	<h3 class="panel-title"><a href="">contact form</a></h3>     	</div>     	<div class="panel-body">     	<form name="form1" id="form1" action="" method="post">     			<fieldset>     			  <input type="text" class="form-control" name="fullname" placeholder="volledige naam" />     			  <br />     			  <input type="text" class="form-control" name="subject" placeholder="onderwerp" />     			  <br />     			  <input type="text" class="form-control" name="phone" placeholder="telefoonnummer" />     			  <br />     			  <input type="email" class="form-control" name="emailid" placeholder="email" /> 			  <br /> 			     <div class="checkbox">       				<label>       				<input type="checkbox" name="check_list[]" value="value1">check me       				</label>       				<label>       				<input type="checkbox" name="check_list[]" value="value2">check me 2       				</label>    			     </div>     			  <br />     			  <textarea rows="4" class="form-control" cols="20" name="comments" placeholder="extra tekst indien gewenst"></textarea>     			  <br />     			  <input type="submit" class="btn btn-success"name="submit" value="verstuur" />     			</fieldset>     	</form>     	<p><?php if(!empty($message)) echo $message; ?></p>     	</div> 	</div> 	</div>     <!-- jquery (necessary bootstrap's javascript plugins) -->     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>     <!-- include compiled plugins (below), or include individual files needed -->     <script src="js/bootstrap.min.js"></script>   </body> </html>

<?php  if(isset($_post['submit']))   {    $message=  'full name:	'.$_post['fullname'].'<br />  subject:	'.$_post['subject'].'<br />  phone:	'.$_post['phone'].'<br />';  foreach($_post['check_list'] $check) {  $message .= .$check . '<br>';         }        email:	'.$_post['emailid'].'<br />  comments:	'.$_post['comments'].'  ';      require "phpmailer-master/class.phpmailer.php"; //include phpmailer class              // instantiate class        $mail = new phpmailer();                // set smtp        $mail->issmtp();                // sets smtp connection        $mail->smtpauth = true;         // connection smtp require authorization          $mail->smtpsecure = "ssl";      // connect using tls connection        $mail->host = "mail.bjornvdakker.me";  //gmail smtp server address      $mail->port = 465;  //gmail smtp port      $mail->encoding = '7bit';            // authentication        $mail->username   = "support@bjornvdakker.me"; // full gmail address      $mail->password   = "5#upjucxab7"; // gmail password              // compose      $mail->setfrom($_post['emailid'], $_post['fullname']);      $mail->addreplyto($_post['emailid'], $_post['fullname']);      $mail->subject = "new contact form enquiry";      // subject (which isn't required)        $mail->msghtml($message);         // send        $mail->addaddress("bjornvdakker@hotmail.com", "mr. example"); // send - recipient      $result = $mail->send();		// send!    	$message = $result ? '<div class="alert alert-success" role="alert"><strong>success!</strong>message sent successfully!</div>' : '<div class="alert alert-danger" role="alert"><strong>error!</strong>there problem delivering message.</div>';      	unset($mail);    }  ?>  <!doctype html>  <html lang="en">    <head>      <meta charset="utf-8">      <meta http-equiv="x-ua-compatible" content="ie=edge">      <meta name="viewport" content="width=device-width, initial-scale=1">      <title>contact form</title>        <!-- bootstrap -->      <link href="css/bootstrap.min.css" rel="stylesheet">      <link rel="stylesheet" href="css/style.css">        <!-- html5 shim , respond.js ie8 support of html5 elements , media queries -->      <!-- warning: respond.js doesn't work if view page via file:// -->      <!--[if lt ie 9]>        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>      <![endif]-->    </head>    <body>    	<div class="contactform">    	<div class="panel panel-default">    		<div class="panel-heading">      	<h3 class="panel-title"><a href="">contact form</a></h3>      	</div>      	<div class="panel-body">      	<form name="form1" id="form1" action="" method="post">      			<fieldset>      			  <input type="text" class="form-control" name="fullname" placeholder="volledige naam" />      			  <br />      			  <input type="text" class="form-control" name="subject" placeholder="onderwerp" />      			  <br />      			  <input type="text" class="form-control" name="phone" placeholder="telefoonnummer" />      			  <br />      			  <input type="email" class="form-control" name="emailid" placeholder="email" />  			  <br />  			     <div class="checkbox">        				<label>        				<input type="checkbox" name="check_list[]" value="value1">check me        				</label>        				<label>        				<input type="checkbox" name="check_list[]" value="value2">check me 2        				</label>     			     </div>      			  <br />      			  <textarea rows="4" class="form-control" cols="20" name="comments" placeholder="extra tekst indien gewenst"></textarea>      			  <br />      			  <input type="submit" class="btn btn-success"name="submit" value="verstuur" />      			</fieldset>      	</form>      	<p><?php if(!empty($message)) echo $message; ?></p>      	</div>  	</div>  	</div>      <!-- jquery (necessary bootstrap's javascript plugins) -->      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>      <!-- include compiled plugins (below), or include individual files needed -->      <script src="js/bootstrap.min.js"></script>    </body>  </html>

add check boxes:

<input type="checkbox" name="check_list[]" value="value1"> 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -