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>
Related
There is problem in opening bootstrap modal in iphones.
If i use static modal like below,
<a href="#responsive" data-toggle="modal"><button class="btn btn-green ">Add Product<i class="fa fa-plus"></i></button>
</a>
<!-- start: BOOTSTRAP EXTENDED MODALS -->
<div id="responsive" class="modal extended-modal fade no-display">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×
</button>
<h4 class="modal-title" style="color:red">Add New Product</h4>
</div>
<div class="modal-body">
<div class="row">
<form name="new" action="<?php echo base_url() ?>admin/addProduct" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="col-md-6">
<h4><b>Category Name <span class="symbol required"></span></b></h4>
<p>
<select class="form-control" name="cat_id" required>
<option value="">---- Select Category ----</option>
<?php foreach($cat['list'] as $rows=>$value){ ?>
<option value="<?php echo $cat['list'][$rows]->cat_id; ?>"><?php echo ucwords($cat['list'][$rows]->cat_name); ?></option>
<?php } ?>
</select>
</p>
</div>
<div class="col-md-6">
<h4><b>Product Name <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="item_name" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Small Description <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="small_desc">
</p>
</div>
<div class="col-md-6">
<h4><b>Quantity<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="quantity" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Customer Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="price" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Reseller Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="reseller" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Color<span class="symbol "></span></b></h4>
<p>
<input class="form-control" type="text" name="color">
</p>
</div>
<div class="col-md-6">
<h4><b>Availability <span class="symbol required"></span></b></h4>
<select class="form-control" name="availability">
<option value="1">Available</option>
<option value="0">Not Available</option>
</select>
</div>
<div class="col-md-6">
<h4><b>Image <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" accept="image/*" onchange="loadFile(event)" type="file" name="userfile" required multiple>
<img id="output" width="100px" height="100px" />
</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="reset" data-dismiss="modal" class="btn btn-light-grey">
Close
</button>
<button type="submit" class="btn btn-blue">
Add Product
</button>
</div>
</form>
</div>
</div>
</div>
<!-- End Modal -->
the modal will open properly and i can enter values.
But if use the modal for editing like below,
<a href="#edit<?php echo $product['list'][$row]->item_id; ?>" data-toggle="modal">
<button class="btn btn-blue"><i class="fa fa-pencil"></i> Edit </button>
</a>
<div id="edit<?php echo $product['list'][$row]->item_id?>" class="modal extended-modal fade no-display">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×
</button>
<h4 class="modal-title" style="color:red">Edit Product</h4>
</div>
<div class="modal-body">
<div class="row">
<form action="<?php echo base_url() ?>admin/editProduct" enctype="multipart/form-data" method="post" autocomplete="off">
<div class="col-md-6">
<h4><b>Category Name <span class="symbol required"></span></b></h4>
<p>
<select class="form-control" name="cat_id" required>
<option value="">---- Select Category ----</option>
<?php
foreach($cat['list'] as $rows=>$value){ ?>
<option value="<?php echo $cat['list'][$rows]->cat_id; ?>"<?php if($cat['list'][$rows]->cat_id == $product['list'][$row]->cat_id) echo "selected=selected"; ?>><?php echo ucwords($cat['list'][$rows]->cat_name); ?></option>
<?php } ?>
</select>
</p>
</div>
<div class="col-md-6">
<input type="hidden" name="item_id" value="<?php echo $product['list'][$row]->item_id;?>">
<input type="hidden" name="image_name" value="<?php echo $product['list'][$row]->image;?>">
<h4><b>Product Name <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="item_name" value="<?php echo $product['list'][$row]->item_name;?>" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Small Description <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="small_desc" value="<?php echo $product['list'][$row]->small_desc;?>">
</p>
</div>
<div class="col-md-6">
<h4><b>Quantity<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="quantity" value="<?php echo $product['list'][$row]->quantity;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Customer Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="price" value="<?php echo $product['list'][$row]->price;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Reseller Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="reseller" value="<?php echo $product['list'][$row]->reseller;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Color<span class="symbol"></span></b></h4>
<p>
<input class="form-control" type="text" name="color" value="<?php echo $product['list'][$row]->color;?>">
</p>
</div>
<div class="col-md-6">
<h4><b>Availability <span class="symbol required"></span></b></h4>
<select class="form-control" name="availability">
<?php if($product['list'][$row]->availability==1){;?>
<option value="1" selected>Available</option>
<option value="0">Not Available</option>
<?php } else {?>
<option value="1">Available</option>
<option value="0" selected>Not Available</option>
<?php }?>
</select>
</div>
<div class="col-md-6">
<h4><b>Status <span class="symbol required"></span></b></h4>
<select class="form-control" name="status">
<?php if($product['list'][$row]->status==0){;?>
<option value="0" selected>Inactive</option>
<option value="1">Active</option>
<?php } else {?>
<option value="0">Inactive</option>
<option value="1" selected>Active</option>
<?php }?>
</select>
</div>
<div class="col-md-6">
<h4><b>Image <span class=""></span>
</b></h4>
<input class="form-control" type="file" name="userfile">
<img src="<?php echo base_url()." assets/uploads/ ".$product['list'][$row]->image;?>" height="50px" width="50px" border="1px solid #FFF">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-light-grey">
Close
</button>
<button type="submit" class="btn btn-blue">
Update
</button>
</div>
</form>
</div>
</div>
</div>
With dynamic id, the modal will open with light black overlay on it. I can't edit the fields. Nothing is working inside the modal.
I am Not Understanding What is the problem with dynamic modal.
If Anyone knows Please reply.
You can try two things. 1. Move your form tag out and place it like this -
<form action="./admin/editProduct" enctype="multipart/form-data" method="post" autocomplete="off">
<div class="modal-body">
Give your modal z-index of 999 or so using css like this -
<style>
.modal {
z-index: 999;
}
</style>
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>
I wan to use securimage captcha for my drupal site,
I have one registration form and and I am submitting that form on same page.
Securimage configuration document says that (here) use session_start() on first line of form processor.
I am having both form and form processor on same page so where should I write session_start()?
This is my code
<form id="user_form" action="" method="post">
<div class="form">
<?php if (isset($errors) && count($errors)>0) : ?>
<ul class="error-list">
<?php foreach ($errors as $e) : ?>
<li><?php echo $e; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="form-section">
<div class="col">
<div class="row">
<label class="two-rows">Select your<br />account type <span>*</span></label>
<select name="uf_user_type" style="width:173px;" class="required">
<option value="">None Selected</option>
<option value="<?php print JOB_SEEKER_ROLE; ?>">Job Seeker</option>
<option value="<?php print MASTER_EMPLOYER_ROLE; ?>">Employer</option>
</select>
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>First Name <span>*</span></label>
<input type="text" class="field required" name="uf_first_name" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>Last Name <span>*</span></label>
<input type="text" class="field required" name="uf_last_name" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>Email <span>*</span></label>
<input type="text" class="field required email-field" name="uf_mail" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<div class="cl"> </div>
</div>
<div class="row">
<label class="two-rows">Image <span>*</span></label>
<img id="captcha" src="/sites/all/themes/jobnow/site/securimage/securimage_show.php" alt="CAPTCHA Image" height="45" width="160" style="border:1px solid #b9b9b9"/>
<a href="#" onclick="document.getElementById('captcha').src = '/sites/all/themes/jobnow/site/securimage/securimage_show.php?' + Math.random(); return false">
<img src="/sites/all/themes/jobnow/site/securimage/images/refresh.png" height="30" width="30" alt="Reload Image" onclick="this.blur()" align="bottom" border="0">
</a>
</div>
</div>
<div class="col right-col">
<div class="row">
<label class="two-rows">How did you <br />hear about us? <span>*</span></label>
<select name="uf_hear_about_us" style="width:173px;" class="required">
<option value="">None Selected</option>
<option>Colleague/Friend</option>
<option>Search Engine</option>
<option>LinkedIn</option>
<option>Twitter</option>
<option>Facebook</option>
<option>Advertisement</option>
<option>In The News</option>
<option>Trade Show/Organization</option>
<option>Other</option>
</select>
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<p class="hint"><?php echo bfstring('hint_register_password'); ?></p>
<label>Password <span>*</span></label>
<input type="password" class="field required" id="pass1" name="uf_password" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label class="two-rows">Confirm <br />Password <span>*</span></label>
<input type="password" class="field required" id="pass2" name="uf_password2" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label class="labelBlack">
<input type="checkbox" class="check required" name="uf_terms" value="1" <?php if(isset($_POST['uf_terms']) && $_POST['uf_terms'] == 1) print 'checked'; ?> />
</label>
<p>I accept the Terms of Service.</p>
<div class="cl"> </div>
</div>
<div class="row">
<div class="cl"> </div>
</div>
<div class="row">
<label class="two-rows">What code is<br />in the image?<span>*</span></label>
<input type="text" class="field required" name="captcha_code" size="10" maxlength="6" />
<div class="cl"> </div>
<em class="status"></em>
</div>
</div>
<div class="cl"> </div>
</div>
<div>
</div>
<div class="form-actions">
<span class="required-info"><strong>*</strong> required</span>
<input type="submit" class="form-submit" value="Create Account" />
Cancel
<div class="cl"> </div>
</div>
</div>
</form>
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$securimage = new Securimage();
$isSecurImageValid=$securimage->check($_POST['captcha_code']) != false;
if ($validator->validateRules($_POST) && $isSecurImageValid)
{
$new_user = new stdClass();
$new_user->roles = array();
$username_base =strtolower(preg_replace('~(.*)\#.*~', '$1', site_rgpc($_POST['uf_mail'])));
$usernames = array();
}
else
{
$errors = $validator->getErrors();
if(!$isSecurImageValid)
$errors[]="The Security Code wasn't entered correctly.";
}
When I integrated this code on my site its saying your captcha is wrong for each and every attempt.
I am not getting what is the issue ?
Same code is working without session_start() on my another similar site.
Please help me
I am having a form as below.
<div class="container">
<form method="post" action="index.php">
<div id="rule">
<div class="row">
<div class="span5">
<input type="text" class="input-xlarge" value="Rule Name"/>
</div>
<div class="span6">
<input type="text" class="input-xxlarge" value="Description"/>
</div>
<div class="clearfix"> </div>
</div>
</div>
<br />
<div id="sel" class="select">
<div class="row">
<div class="span1 offset2">
<p class="btn btn-danger">If</p>
</div>
<div class="span2">
<select class="span2" name="metrics">
<option value="bounce_rate">Bounce Rate</option>
<option value="location">Locations</option>
<option value="social_media">Social Media</option>
<option value="search">Search</option>
<option value="visits">Visitors</option>
</select>
</div>
<div class="span1">
<select name="conditions" class="span2">
<option value=">">></option>
<option value="<"><</option>
<option value=">=">>=</option>
<option value="<="><=</option>
<option value="=">=</option>
</select>
</div>
<div class="span1 offset1">
<input type="text" name="percentage" class="input-small"/>
</div>
<div class="clearfix"> </div>
</div>
<br />
<div class="row">
<div class="span1 offset2">
<p class="btn btn-danger">Period</p>
</div>
<div class="span3">
<div class="input-append date datepicker" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
<input class="span2" size="16" type="text" value="12-02-2012" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="span3">
<div class="input-append date datepicker" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
<input class="span2" size="16" type="text" value="12-02-2012" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
<div id="dyna"></div>
<div id="end">
<div class="row">
<div class="span1">
<p class="btn btn-danger">THEN</p>
</div>
<div class="span3">
<input type="text" class="input-xlarge" value="Statement" />
</div>
<div class="clearfix"> </div>
</div>
<div class="row">
<div class="span1">
<p class="btn btn-danger">ELSE</p>
</div>
<div class="span3">
<input type="text" class="input-xlarge" value="Statement" />
</div>
<div class="clearfix"> </div>
</div>
<div class="row">
<button class="span1 btn btn-success" type="submit" value="submit">Submit</button>
<div class="span2 offset9">
<p class="btn btn-success input-small" id="addRule">Add Rule </p>
</div>
<div class="clearfix"> </div>
</div>
</div>
</form>
</div>
I have included a button 'Add Rule' to create a dynamic elements within the above . So I used a javascript for creating dynamic elements as same of above.
The javascript as below.
<script type="text/javascript">
$('.datepicker').datepicker();
(function(){
var i = 0;
$("#addRule").live('click',function(){
++i;
var $ctrl = $('<div id="'+ i +'" class="select"><div class="row"><div class="span1 offset2"><button class="btn btn-danger">If</button></div><div class="span2"><select class="span2" name="metrics"><option value="bounce_rate">Bounce Rate</option><option value="location">Locations</option><option value="social_media">Social Media</option><option value="search">Search</option><option value="visits">Visitors</option></select></div><div class="span1"><select name="conditions" class="span2"><option value=">">></option><option value="<"><</option><option value=">=">>=</option><option value="<="><=</option><option value="=">=</option></select></div><div class="span1 offset1"><input type="text" name="percentage" class="input-small"/></div><div class="span2 offset1"><button class="btn btn-danger remove" id="'+ i +'">Remove</button></div><div class="clearfix"> </div></div><br /><div class="row"><div class="span1 offset2"><p class="btn btn-danger">Period</p></div><div class="span3"><div class="input-append date datepicker" data-date="12-02-2012" data-date-format="dd-mm-yyyy"><input class="span2" size="16" type="text" value="12-02-2012" /><span class="add-on"><i class="icon-th"></i></span></div></div><div class="span3"><div class="input-append date datepicker" data-date="12-02-2012" data-date-format="dd-mm-yyyy"><input class="span2" size="16" type="text" value="12-02-2012" /><span class="add-on"><i class="icon-th"></i></span></div></div><div class="clearfix"> </div></div></div>');
$("#dyna").append($ctrl);
$('.datepicker').datepicker();
});
}) ();
(function(){
$(".remove").live('click',function(){
var remDiv = $(this).attr('id');
//var questionList = "questionList"+remQ;
$("#" + remDiv).remove();
});
}) ();
So I wanna get the values once i click the submit button. Is it correct way what i am using only a form for fetching the data or am i create two forms separately? So how to do that?
You do not need to create a second form if you are inserting the new elements into the existing form and as long as they have different names from any existing inputs you want to receive.
You can create a second form if you want different submit buttons for the two different collections of input data.