I want to extract just the paragraphs in each .pertanyaan class, before the .listjawaban class using DomCrawler/Goutte Symfony component
Is there any way to do this?
I'm coming with $crawler->filter('.pertanyaan p')->eq($i)->html() but it just gives me the first paragraph, because $i is the n-th position of .pertanyaan class.
<div class="pertanyaan"><p></p>
<p>Karena mengalami mutasi, kromosom mengalami perubahan seperti pada gambar di bawah.</p>
<p><img src="http://indocademy.com/images/ipa_2013_133/53_1.png" alt=""><br>Jenis mutasi tersebut adalah ....</p>
<p></p>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_A" value="A" style="display:none" disabled=""><input type="radio" name="answer_758" id="answer_758_A" value="A" onclick="showbutton(758);">A.
</div>
<div class="pilihanjawaban">
adisi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_B" value="B" style="display:none" disabled=""><input type="radio" name="answer_758" id="answer_758_B" value="B" onclick="showbutton(758);">B.
</div>
<div class="pilihanjawaban">
delesi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_C" value="C" style="display:none" disabled=""><input type="radio" name="answer_758" id="answer_758_C" value="C" onclick="showbutton(758);">C.
</div>
<div class="pilihanjawaban">
inversi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_D" value="D" style="display:none" disabled=""><input type="radio" name="answer_758" id="answer_758_D" value="D" onclick="showbutton(758);">D.
</div>
<div class="pilihanjawaban">
duplikasi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_E" value="E" style="display:none" disabled=""><input type="radio" name="answer_758" id="answer_758_E" value="E" onclick="showbutton(758);">E.
</div>
<div class="pilihanjawaban">
translokasi
</div>
</div>
<div class="buttons">
<input type="button" class="tombol_jawab" id="tombol_jawab_758" value="Jawab" style="display:none" onclick="executejawaban(758,"http://indocademy.com")"><input type="button" class="tombol_clear" id="tombol_clear_758" value="Hapus" style="display:none" onclick="clearjawaban(758)">
</div>
<div class="kunci" id="kunci_758" style="display: none">
<div class="tulisanjawab abu">
<input type="button" id="tombol_kunci" value="+" class="jawaban_758" onclick="showkunci(this)">
Jawaban : <img id="loading_758" src="http://indocademy.com/images/loading.gif" style="height:12px;vertical-align:middle">
<span id="hasil_758"> </span>
</div>
<div class="konten_kunci">
<div class="konten_jawaban_758" id="isi_jawaban"></div>
</div>
</div>
</div>
This is the url I want to crawl: http://indocademy.com/soal/sbmptn/biologi/2013
Everything goes fine except when crawling but at number #53 since there are three paragraph tags to extract (I only assumed each number has its first paragraph tag being the question, and I don't know how to extract all the paragraphs before .listjawaban class)
Please help
Since the page at the URL doesn't have the structure and the class .pertanyaan does not exist, I copied the HTML snippet into a script and used the DomCrawler to get the four elements.
#!/usr/bin/php
<?php
require ('vendor/autoload.php');
use Symfony\Component\DomCrawler\Crawler;
$html = <<<'HTML'
<div class="pertanyaan">
<p></p>
<p>Karena mengalami mutasi, kromosom mengalami perubahan seperti pada gambar di bawah.</p>
<p><img src="http://indocademy.com/images/ipa_2013_133/53_1.png" alt=""><br>Jenis mutasi tersebut adalah ....</p>
<p></p>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_A" value="A" style="display:none" disabled="">
<input type="radio" name="answer_758" id="answer_758_A" value="A" onclick="showbutton(758);">A.
</div>
<div class="pilihanjawaban">
adisi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_B" value="B" style="display:none" disabled="">
<input type="radio" name="answer_758" id="answer_758_B" value="B" onclick="showbutton(758);">B.
</div>
<div class="pilihanjawaban">
delesi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_C" value="C" style="display:none" disabled="">
<input type="radio" name="answer_758" id="answer_758_C" value="C" onclick="showbutton(758);">C.
</div>
<div class="pilihanjawaban">
inversi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_D" value="D" style="display:none" disabled="">
<input type="radio" name="answer_758" id="answer_758_D" value="D" onclick="showbutton(758);">D.
</div>
<div class="pilihanjawaban">
duplikasi
</div>
</div>
<div class="listjawaban">
<div class="radiojawaban">
<input type="radio" name="answer_dup_758" id="answer_dup_758_E" value="E" style="display:none" disabled="">
<input type="radio" name="answer_758" id="answer_758_E" value="E" onclick="showbutton(758);">E.
</div>
<div class="pilihanjawaban">
translokasi
</div>
</div>
<div class="buttons">
<input type="button" class="tombol_jawab" id="tombol_jawab_758" value="Jawab" style="display:none" onclick="executejawaban(758,"http://indocademy.com")"><input type="button" class="tombol_clear" id="tombol_clear_758" value="Hapus" style="display:none"
onclick="clearjawaban(758)">
</div>
<div class="kunci" id="kunci_758" style="display: none">
<div class="tulisanjawab abu">
<input type="button" id="tombol_kunci" value="+" class="jawaban_758" onclick="showkunci(this)"> Jawaban : <img id="loading_758" src="http://indocademy.com/images/loading.gif" style="height:12px;vertical-align:middle">
<span id="hasil_758"> </span>
</div>
<div class="konten_kunci">
<div class="konten_jawaban_758" id="isi_jawaban"></div>
</div>
</div>
</div>
HTML;
$crawler = new Crawler($html);
$output = $crawler->filter('.pertanyaan p')->each(function ($node) {
return $node->html();
});
print_r($output);
The function each() returns an array of the four paragraphs. The resulting array is here:
Array
(
[0] =>
[1] => Karena mengalami mutasi, kromosom mengalami perubahan seperti pada gambar di bawah.
[2] => <img src="http://indocademy.com/images/ipa_2013_133/53_1.png" alt=""><br>Jenis mutasi tersebut adalah ....
[3] =>
)
Related
If I click on one check box another check box also checked.
addquiz.php
<?php
$unique_id = time().'_'.uniqid(true);
$userid = $this->session->userdata('cp_userid');
?>
<!-- DC QUIZZ -->
<form class="addquizform" id="quiz_form_<?php echo $unique_id;?>" data-form = "<?php echo $unique_id;?>" data-user = '<?php echo $userid ?>'>
<input type="hidden" name="sid" value="<?php echo $sectionId;?>">
<input type="hidden" name="cid" value="<?php echo $courseId;?>">
<div class="dc-quizz-info dc-course-item">
<div class="dc-content-title">
<h5 class="xsm black">Quiz : Title of quiz</h5>
<div class="course-region-tool">
<input type="button" value = "Save" class="mc-btn-3 btn-style-1 savequiz save" id="save_quiz_<?php echo $unique_id;?>">
</div>
</div>
<div class="quizz-body dc-item-body">
<div class="form-item form-checkbox checkbox-style">
<input type="checkbox" id="showanswer" value="1" name="showanswer">
<label for="showanswer">
<i class="icon-checkbox icon md-check-1"></i>
Show Answer
</label>
</div>
<div class="form-item form-checkbox checkbox-style">
<input type="checkbox" id="limittime">
<label for="limittime">
<i class="icon-checkbox icon md-check-1"></i>
Limit time
</label>
</div>
<div class="time">
<div class="form-item">
<input type="text" name="limittime">
<label for="">mins</label>
</div>
</div>
<div class="form-item">
<input type="text" placeholder="Quiz Title" class="fullwidth" name="quiztitle">
</div>
<div class="form-item">
<input type="text" placeholder="Short introduction" class="fullwidth" name="quizintro">
</div>
</div>
</div>
</form>
<!-- END / DC QUIZZ -->
when I go to add one more quiz it asks to check the check box, but when I clicked on check box above check box also checked. How to over come this problem.
Please Check The Name as well as id You Defined there is missing an id and name for checkbox
<div class="dc-quizz-info dc-course-item">
<div class="dc-content-title">
<h5 class="xsm black">Quiz : Title of quiz</h5>
<div class="course-region-tool">
<input type="button" value = "Save" class="mc-btn-3 btn-style-1 savequiz save" id="save_quiz_<?php echo $unique_id;?>">
</div>
</div>
<div class="quizz-body dc-item-body">
<div class="form-item form-checkbox checkbox-style">
<input type="checkbox" id="showanswer" value="1" name="showanswer">
<label for="showanswer">
<i class="icon-checkbox icon md-check-1"></i>
Show Answer
</label>
</div>
<div class="form-item form-checkbox checkbox-style">
<input type="checkbox" name="limitcheck" id="limitcheck">
</div>
<div class="time">
<label for="limittime">
<i class="icon-checkbox icon md-check-1"></i>
Limit time
</label>
<div class="form-item">
<input type="text" value="" id="limittime" name="limittime">
<label for="">mins</label>
</div>
</div>
<div class="form-item">
<input type="text" placeholder="Quiz Title" class="fullwidth" name="quiztitle">
</div>
<div class="form-item">
<input type="text" placeholder="Short introduction" class="fullwidth" name="quizintro">
</div>
</div>
</div>
Picture of the issue.
I'm learning how to display mysql database data with php and running into a slight issue with alignment. The page-header of this site doesn't align with the first row of products. Here's the code:
<div class="container">
<div class="page-header">
<h1>For Sale</h1>
</div>
<div class="products">
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4">
<li class="product thumbnail">
<form method="post" action="cart_update.php">
<div class="product-content">
<div class="product-thumb"><img src="{$obj->product_img_name}" style="width:100%"></div>
<div class="caption">
<h3>{$obj->product_name}</h3>
<div class="product-desc"><p>{$obj->product_desc}</p></div>
<div class="product-info">
Price: {$currency}{$obj->price}
</div>
<fieldset>
<label>
<span>Color</span>
<select name="product_color">
<option value="Black">Black</option>
<option value="Silver">Silver</option>
</select>
</label>
<label>
<span>Quantity</span>
<input type="text" size="2" maxlength="2" name="product_qty" value="1" />
</label>
</fieldset>
<input type="hidden" name="product_code" value="{$obj->product_code}" />
<input type="hidden" name="type" value="add" />
<input type="hidden" name="return_url" value="{$current_url}" />
<div align="left"><button type="submit" class="add_to_cart btn btn-primary">Add</button></div>
</div></div>
</form>
</li>
</div>
Since you're using bootstrap, wrapping the <h1> tag with a <div class="container"> will horizontally align the title with your product items.
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="page-header">
<div class="container">
<h1>For Sale</h1>
</div>
</div>
<div class="products">
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4">
<li class="product thumbnail">
<form method="post" action="cart_update.php">
<div class="product-content">
<div class="product-thumb"><img src="https://placehold.it/350x150" style="width:100%"></div>
<div class="caption">
<h3>name</h3>
<div class="product-desc">
<p>description</p>
</div>
<div class="product-info">
Price: $ 10,50
</div>
<fieldset>
<label>
<span>Color</span>
<select name="product_color">
<option value="Black">Black</option>
<option value="Silver">Silver</option>
</select>
</label>
<label>
<span>Quantity</span>
<input type="text" size="2" maxlength="2" name="product_qty" value="1" />
</label>
</fieldset>
<input type="hidden" name="product_code" value="{$obj->product_code}" />
<input type="hidden" name="type" value="add" />
<input type="hidden" name="return_url" value="{$current_url}" />
<div align="left">
<button type="submit" class="add_to_cart btn btn-primary">Add</button>
</div>
</div>
</div>
</form>
</li>
</div>
I have two data tables like users and questions for login page and information page
when login I redirect do information page and I enter data in it after submitting I want to get this login user name to that questions data table, pls help me
login page like below
<?php
session_start();
?>
<html>
<head lang="en">
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="bootstrap-3.2.0-dist\css\bootstrap.css">
<title>Login</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Sign In</h3>
</div>
<div class="panel-body">
<form role="form" method="post" action="login.php">
<fieldset>
<div class="form-group" >
<input class="form-control" placeholder="E-mail" name="email" type="email" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="pass" type="password" value="">
</div>
<input class="btn btn-lg btn-success btn-block" type="submit" value="login" name="login" >
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
include("db_conection.php");
if(isset($_POST['login']))
{
$user_email=$_POST['email'];
$user_pass=$_POST['pass'];
$check_user="select * from users WHERE user_email='$user_email'AND user_pass='$user_pass'";
$run=mysqli_query($dbcon,$check_user);
if(mysqli_num_rows($run))
{
echo "<script>window.open('welcome.php','_self')</script>";
$_SESSION['email']=$user_email;
}
else
{
echo "<script>alert('Email or password is incorrect!')</script>";
}
}
?>
inner data page
<?php
session_start();
if(!$_SESSION['email'])
{
header("Location: login.php");
}
if(isset($_POST['submit'])){
header("Location: feedback.php");
exit;
}
?>
<html>
<head>
<title>
Registration
</title>
</head>
<body>
<h1>Welcome</h1><br>
<?php
echo $_SESSION['email'];
?>
<form action="profile.php" method="post">
<input type='submit' name='submit' value='Give Us Your Feedback' class='register' />
</form>
<h1>Logout here </h1>
</body>
</html>
data page
<?php
session_start();
include("config.php");
if(isset($_POST['submit']))
{
$answer1=$_POST['answer1'];
$answer2=$_POST['answer2'];
$answer3=$_POST['answer3'];
$answer4=$_POST['answer4'];
$answer5=$_POST['answer5'];
$answer6=$_POST['answer6'];
$insert=mysqli_query($conn,"insert into question(ans1,ans2,ans3,ans4,ans5,ans6)values('$answer1','$answer2','$answer3','$answer4','$answer5','$answer6')");
if($insert==TRUE)
{
header("Location:thanks.html");
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Feedback Form</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<META http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<h3>Feedback Form</h3>
<div class="container">
<div class="row">
<div class="col-md-8 well">
<form class="sky-form" name="answer" method="post">
<div class="panel panel-default">
<ul class="list-group">
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-1" data-toggle="detail-1">
<div class="col-xs-10">
How did you contact technical support?
</div>
<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-1">
<hr></hr>
<div class="container">
<div class="fluid-row">
<div class="radio">
<input type="radio" name="answer1" id="a1" value="In Person"><label for="a1">In Person </label> <br>
<input type="radio" name="answer1" id="a2" value="Over the Telephone"><label for="a2">Over the Telephone </label><br>
<input type="radio" name="answer1" id="a3" value="Via Email"><label for="a3">Via Email</label><br>
<input type="radio" name="answer1" id="a4" value="Via Internet Chat"><label for="a4">Via Internet Chat </label>
</div>
</div>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-2" data-toggle="detail-2">
<div class="col-xs-10">
Overall, how would you rate the process for getting your problem resolved?
</div>
<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-2">
<hr></hr>
<div class="container">
<div class="fluid-row">
<div class="radio">
<input type="radio" name="answer2" id="b1" value="Very Good"><label for="b1">Very Good </label> <br>
<input type="radio" name="answer2" id="b2" value="Good"><label for="b2">Good </label><br>
<input type="radio" name="answer2" id="b3" value="Average"><label for="b3">Average</label><br>
<input type="radio" name="answer2" id="b4" value="Poor"><label for="b4">Poor </label><br>
<input type="radio" name="answer2" id="b5" value="Very Poor"><label for="b5">Very Poor </label>
</div>
</div>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-3" data-toggle="detail-3">
<div class="col-xs-10">
About how long did you have to wait before speaking to a technical support representative?
</div>
<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-3">
<hr></hr>
<div class="container">
<div class="fluid-row">
<div class="radio">
<input type="radio" name="answer3" id="c1" value="I was taken care of immediately"><label for="c1">I was taken care of immediately </label> <br>
<input type="radio" name="answer3" id="c2" value="Within 10 minutes"><label for="c2">Within 10 minutes</label><br>
<input type="radio" name="answer3" id="c3" value="Between 10 to 30 minutes"><label for="c3">Between 10 to 30 minutes</label><br>
<input type="radio" name="answer3" id="c4" value="Between 30 minutes to an hour"><label for="c4">Between 30 minutes to an hour</label><br>
<input type="radio" name="answer3" id="c5" value="More than 1 hour"><label for="c5">More than 1 hour</label>
</div>
</div>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-4" data-toggle="detail-4">
<div class="col-xs-10">
About how long did you have to wait before your issue was resolved?
</div>
<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-4">
<hr></hr>
<div class="container">
<div class="fluid-row">
<div class="radio">
<input type="radio" name="answer4" id="d1" value="Within 2 hours"><label for="d1">Within 2 hours</label> <br>
<input type="radio" name="answer4" id="d2" value="Between 2 to 4 hours"><label for="d2">Between 2 to 4 hours</label><br>
<input type="radio" name="answer4" id="d3" value="Between 4 to 8 hours"><label for="d3">Between 4 to 8 hours</label><br>
<input type="radio" name="answer4" id="d4" value="Between 8 to 12 hours"><label for="d4">Between 8 to 12 hours</label><br>
<input type="radio" name="answer4" id="d5" value="More than 12 hours"><label for="d5">More than 12 hours</label>
</div>
</div>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-5" data-toggle="detail-5">
<div class="col-xs-10">
The Technical Support Representative was knowledgeable?
</div>
<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-5">
<hr></hr>
<div class="container">
<div class="fluid-row">
<div class="radio">
<input type="radio" name="answer5" id="e1" value="Strongly Agree"><label for="e1">Strongly Agree</label> <br>
<input type="radio" name="answer5" id="e2" value="Agree"><label for="e2">Agree</label><br>
<input type="radio" name="answer5" id="e3" value="Neutral"><label for="e3">Neutral</label><br>
<input type="radio" name="answer5" id="e4" value="Disagree"><label for="e4">Disagree</label><br>
<input type="radio" name="answer5" id="e5" value="Strongly Disagree"><label for="e5">Strongly Disagree</label>
</div>
</div>
</div>
</div>
</li>
<label for="title">Please share any additional comments about your experience or suggestions on how we can better improve our technical support services.</label>
<textarea class="form-control" rows="3" name="answer6" maxlength="250">
</textarea>
</ul>
<div id="my_centered_buttons">
<button type="submit" name="submit" value="submit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
When you login then I think you have to store user information in to session and you can get user information directly from session including username.
I am trying to have a custom form on my website. The form gathers diet preferences, and upon submit, I'd like to grab that information with their name and email, and add it to a list in Mailchimp. I have setup the list correctly in Mailchimp, and the form is built and styled on my page. I followed the following article, as you can see in my code, based on Mailchimp's recommendation on creating a custom form.
http://kb.mailchimp.com/lists/signup-forms/host-your-own-signup-forms
I think I have connected each input to it's corresponding element in the Mailchimp list, but when I hit the submit button, nothing happens for about 20 seconds and then I get the following error:
Connection could not be established with host mail.yourdomain.com [Operation timed out #60]
I am currently developing on a local server using MAMP - and feel this may be an issue, but if not what can I do to make this custom form work properly?
<form action="https://platesite.us14.list-manage.com/subscribe/post" method="POST" class="text-center form-email">
<input type="hidden" name="u" value="694035325d6c49e6922fda852">
<input type="hidden" name="id" value="e9b40e5d0e">
<h4 class="uppercase mt48 mt-xs-0">Tell Us about yourself</h4>
<p class="lead mb64 mb-xs-24">
Share a little bit about your taste preferences <br>
so we can create a plan just for you.
</p>
<div class="overflow-hidden">
<hr>
<h6 class="uppercase">
1. What is your plan preference?
</h6>
<div class="col-sm-3">
<p class="mb16">
Simply Healthy
</p>
<div class="checkbox-option text-left">
<div class="inner"></div>
<input type="radio" name="MERGE3" value="Simply Healthy" />
</div>
</div>
<div class="col-sm-3">
<p class="mb16">
Paleo
</p>
<div class="checkbox-option text-left">
<div class="inner"></div>
<input type="radio" name="MERGE3" value="Paleo" />
</div>
</div>
<div class="col-sm-3">
<p class="mb16">
Vegetarian
</p>
<div class="checkbox-option text-left">
<div class="inner"></div>
<input type="radio" name="MERGE3" value="Vegetarian" />
</div>
</div>
<div class="col-sm-3">
<p class="mb16">
Gluten-Free
</p>
<div class="checkbox-option text-left">
<div class="inner"></div>
<input type="radio" name="MERGE3" value="Gluten-Free" />
</div>
</div>
<hr>
</div>
<div class="overflow-hidden">
<div class="col-sm-6 col-sm-offset-3">
<h6 class="uppercase">
2. How many people are you cooking for?
</h6>
<div class="select-option">
<i class="ti-angle-down"></i>
<select name="MERGE4">
<option selected value="Default">Select An Option</option>
<option value="google">1</option>
<option value="website">2</option>
<option value="friend">3</option>
<option value="friend">4</option>
<option value="friend">5</option>
<option value="other">6</option>
</select>
</div>
</div>
<hr>
</div>
<div class="overflow-hidden">
<h6 class="uppercase">
3. How long do you typically have to prepare meals?
</h6>
<div class="col-sm-3">
<p>
Less than 20 min. </p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE5" value="less than 20" />
</div>
</div>
<div class="col-sm-3">
<p>20 - 35 min.</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE5" value="20-35" />
</div>
</div>
<div class="col-sm-3">
<p>35 - 60 min.</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE5" value="35-60" />
</div>
</div>
<div class="col-sm-3">
<p>60+ min.</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE5" value="60+" />
</div>
</div>
<hr>
</div>
<div class="overflow-hidden">
<h6 class="uppercase">
3. How adventurous are you with cooking?
</h6>
<div class="col-sm-4">
<p>
I like simple food, thanks </p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE6" value="I like simple food, thanks" />
</div>
</div>
<div class="col-sm-4">
<p>I'll try it if it sounds good</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE6" value="I'll try it if it sounds good" />
</div>
</div>
<div class="col-sm-4">
<p>I'll try anything!</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE6" value="I'll try anything!" />
</div>
</div>
<hr>
</div>
<div class="overflow-hidden">
<h6 class="uppercase">
4. What ingredients would you like to avoid?
</h6>
<div class="col-sm-2">
<p>All Dairy</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="All Dairy" />
</div>
</div>
<div class="col-sm-2">
<p>Cheese</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Cheese" />
</div>
</div>
<div class="col-sm-2">
<p>Eggs</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Eggs" />
</div>
</div>
<div class="col-sm-2">
<p>Tree Nuts</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Tree Nuts" />
</div>
</div>
<div class="col-sm-2">
<p>Peanuts</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Peanuts" />
</div>
</div>
<div class="col-sm-2">
<p>Soy</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Soy" />
</div>
</div>
<div class="col-sm-2">
<p>Tofu</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Tofu" />
</div>
</div>
<div class="col-sm-2">
<p>Beef</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Beef" />
</div>
</div>
<div class="col-sm-2">
<p>Chicken</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Chicken" />
</div>
</div>
<div class="col-sm-2">
<p>Pork</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Pork" />
</div>
</div>
<div class="col-sm-2">
<p>Lamb</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Lamb" />
</div>
</div>
<div class="col-sm-2">
<p>Fish</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Fish" />
</div>
</div>
<div class="col-sm-2">
<p>Shellfish</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Shellfish" />
</div>
</div>
<div class="col-sm-2">
<p>Avocado</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Avocado" />
</div>
</div>
<div class="col-sm-2">
<p>Cilantro</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Cilantro" />
</div>
</div>
<div class="col-sm-2">
<p>Bell Pepper</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Bell Pepper" />
</div>
</div>
<div class="col-sm-2">
<p>Mushroom</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Mushroom" />
</div>
</div>
<div class="col-sm-2">
<p>Spicy Food</p>
<div class="radio-option">
<div class="inner"></div>
<input type="radio" name="MERGE7" value="Spicy Food" />
</div>
</div>
<div class="col-sm-8 col-sm-offset-2">
<div class="inner"></div>
<input type="text" name="MERGE8" class="col-md-12 " placeholder="Other (list separated by comma)" />
</div>
<hr>
</div>
<div class="overflow-hidden">
<h6 class="uppercase">
3. Your Account Details
</h6>
<input type="text" name="MERGE1" class="col-md-6 validate-required" placeholder="First Name*" />
<input type="text" name="MERGE2" class="col-md-6 validate-required" placeholder="Last Name*" />
<input type="text" name="MERGE0" class="col-md-12 validate-required validate-email" placeholder="Your Email Address*" />
<hr>
</div>
<div class="overflow-hidden">
<div class="col-sm-6 col-sm-offset-3">
<h6 class="uppercase">
4. Lastly, how did you hear of us?
</h6>
<div class="select-option">
<i class="ti-angle-down"></i>
<select name="MERGE9">
<option selected value="Default">Select An Option</option>
<option value="google">Google</option>
<option value="website">Facebook</option>
<option value="friend">Instagram</option>
<option value="friend">Friend Referral</option>
<option value="friend">Influencer Referral</option>
<option value="friend">Blog</option>
<option value="other">Other</option>
</select>
</div>
<input type="submit" class="button" name="submit" value="Subscribe to list">
<input type="hidden" name="ht" value="b750d7603dc70714c655f39211d647bec3bed54f:MTQ4MDQ4Nzc0OS44NTIx">
<input type="hidden" name="mc_signupsource" value="hosted">
</div>
</div>
</form>
Im trying to bootstrap a mulitple choice tickbox for PHP. I have the following code:
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon">
<form action="catcheck.php" method="post">
<input type="checkbox" name="check_list[]" value="value 1">
<input type="submit" />
</form>
</span>
</div>
</div>
</div>
</div>
But im just getting a normal checkbox, how do I go about changing this to submit to catcheck.php whilst using the bootstrap css?
The below code will work (Hope this is what you needed):
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon">
<form action="catcheck.php" method="post" role="form">
<label>
<input type="checkbox" name="check_list[]" value="value 1" /> Value 1
</label>
<label>
<input type="checkbox" name="check_list[]" value="value 2" /> Value 2
</label>
<label>
<input type="checkbox" name="check_list[]" value="value 3" /> Value 3
</label>
<label>
<input type="checkbox" name="check_list[]" value="value 4" /> Value 4
</label>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</span>
</div>
</div>
</div>
</div>
In catcheck.php
You can retrieve data as $_POST['check_list'] which will return an array. You can begin from:
echo "<pre>";
print_r($_POST);
echo "</pre>";
EDIT:
The below code will do what you have asked (with doc reference)
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" name="check_list[]" value="value 1" />
</span>
<input type="text" name="text_value[]" class="form-control" />
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" name="check_list[]" value="value 2" />
</span>
<input type="text" name="text_value[]" class="form-control" />
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" name="check_list[]" value="value 3" />
</span>
<input type="text" name="text_value[]" class="form-control" />
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" name="check_list[]" value="value 4" />
</span>
<input type="text" name="text_value[]" class="form-control" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
For alignment consider the following CSS:
.input-group
{
margin-bottom:10px;
}
You can adjust the size of input area by reducing col-lg-6 to col-lg-4 and so on.
Fiddle Demo : http://jsfiddle.net/27LnT/