this is my block of code for insert product of my project
<?php
include('includes/db.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html lang="EN">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="images/logo.jpg" type="image/x-icon" />
<title>Insert Products</title>
<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>
<script>tinymce.init({ selector:'textarea' });</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="fontawesome/css/font-awesome.min.css" />
</head>
<body>
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li class="active"><i class="fa fa-dashboard"></i>Dashboard/Insert Products</li>
</ol> <!--breadcrumb ends here-->
</div> <!---col-lg-12 ends-->
</div> <!--row ends-->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-money fa-fw"></i> Insert Products
</h3>
</div> <!--panel heading ends--->
<div class="panel-body">
<form class="form-horizontal" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="col-md-3 control-label" >Product title</label>
<div class="col-md-6">
<input type="text" name="product_title" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Category</label>
<div class="col-md-6">
<select name="product_cat" class="form-control" required>
<option>Select Category</option>
<?php
$get_p_cats="select * from product_categories";
$run_p_cats=mysqli_query($conn,$get_p_cats);
while($row_p_cats=mysqli_fetch_array($run_p_cats)){
$p_cat_id=$row_p_cats['p_cat_id'];
$p_cat_title=$row_p_cats['p_cat_title'];
echo "<option value='$p_cat_id'>$p_cat_title</option>";
}
?>
</select>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Category</label>
<div class="col-md-6">
<select name="cat" class="form-control" required>
<option>Select Category</option>
<?php
$get_cat="select * from categories";
$run_cat=mysqli_query($conn,$get_cat);
while($row_cat=mysqli_fetch_array($run_cat)){
$cat_id=$row_cat['cat_id'];
$cat_title=$row_cat['cat_title'];
echo "<option value='$cat_id'>$cat_title</option>";
}
?>
</select>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Image 1</label>
<div class="col-md-6">
<input type="file" name="product_img1" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Image 2</label>
<div class="col-md-6">
<input type="file" name="product_img2" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Image 3</label>
<div class="col-md-6">
<input type="file" name="product_img3" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Price</label>
<div class="col-md-6">
<input type="text" name="product_price" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Keywords</label>
<div class="col-md-6">
<input type="text" name="product_keywords" class="form-control" required>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" >Product Description</label>
<div class="col-md-6">
<textarea name="product_desc" class="form-control" rows="6" cols="19" style="max-width:100%; max-height:100%;"></textarea>
</div>
</div> <!---form-group-->
<div class="form-group">
<label class="col-md-3 control-label" ></label>
<div class="col-md-6">
<input type="submit" name="submit" value="Insert Product" class="btn btn-primary form-control">
</div>
</div> <!---form-group-->
</form> <!--form-horizontal ends--->
</div> <!--panel-body ends-->
</div> <!---panel panel-default ends-->
</div> <!--col-lg-12 ends--->
</div> <!--row 2 ends-->
</body>
</html>
<?php
if(isset($_POST['submit'])){
$product_title=$_POST['product_title'];
$product_cat=$_POST['product_cat'];
$cat=$_POST['cat'];
$product_price=$_POST['product_price'];
$product_desc=$_POST['product_desc'];
$product_keyword=$_POST['product_keywords'];
$product_img1=$_FILES['product_img1']['name'];
$product_img2=$_FILES['product_img2']['name'];
$product_img3=$_FILES['product_img3']['name'];
$temp_name1=$_FILES['product_img1']['tmp_name'];
$temp_name2=$_FILES['product_img2']['tmp_name'];
$temp_name3=$_FILES['product_img3']['tmp_name'];
move_uploaded_file($temp_name1,"product_images/$product_img1");
move_uploaded_file($temp_name2,"product_images/$product_img2");
move_uploaded_file($temp_name3,"product_images/$product_img3");
$insert_product="insert into products(p_cat_id,cat_id,date,product_title,product_img1,product_img2,product_img3,product_price,product_desc,product_keywords) values( '$product_cat','$cat',NOW(),'$product_title','$product_img1','$product_img2','$product_img3','$product_price','$product_desc','$product_keyword')";
$run_product=mysqli_query($conn,$insert_product);
if($run_product){
echo "<script>alert('Product has been inserted successfully')</script>";
echo "<script>window.open('insert.php','self')</script>";
}
}
?>
Even after defining variable i get error Undefined index: product_price in C:\xampp\htdocs\RangProject\admin_area\insert_products.php on line 183
this is my line 183
$product_price=$_POST['product_price'];
can someone tell me what my mistake is?? Php is quite confusing and case sensitive.
check if your post is not empty before assigning.
$product_price = isset($_POST['product_price']) ? $_POST['product_price'] : '';
fixed my error. Just added this after taking some advice from all my replies i got. Thanks everyone.
$product_title=mysqli_real_escape_string($conn,$_POST['product_title']);
$product_cat=mysqli_real_escape_string($conn,$_POST['product_cat']);
$cat=mysqli_real_escape_string($conn,$_POST['cat']);
$product_price =mysqli_real_escape_string($conn,$_POST['product_price']);
$product_desc=mysqli_real_escape_string($conn,$_POST['product_desc']);
$product_keyword=mysqli_real_escape_string($conn,$_POST['product_keywords']);
This happens because "product_price" does not exist on $_POST.
To avoid this error, check if it exists first using isset():
$product_price = isset($_POST['product_price']) ? $_POST['product_price'] : '';
Related
I want to se available dates in a dropdown - done
After i´v choosen the date i want to see the available time - done
The customer should be able to book the choosen timeslot - I think i knowe this one, work in progress.
Problem: I want the customer to se the dropdown and the result in the same page and maybe change it when the time comes visably. I´v been playing around with action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" but thats not it i belive.
I am a bit lost in best practice regarding files and jumps betveen them. I have separated the php and html code in different pages. When i´m ready i lift the php-files to includes folder offcourse.
HTML - form with dropdown and submit
php - fill dropdown with dates
html - form with result text fields
php - code for result (timeslot data)
form_date.php
<?PHP
require_once('booking_available_dates.php');
?>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<form name='date_registration' action='booking_available_dates.php' method='POST'>
<div class="form-group row">
<label for="select" class="col-2 col-form-label">Hämta första lediga tid för valt datum</label>
<div class="col-10">
<select id="date_input" name="date_input" class="custom-select">
<?php foreach ($dates as $row): ?>
<option><?=$row["date_booking_customer"]?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<button name="submit" type="submit" class="btn btn-primary">Hämta tid!</button>
</div>
</div>
</form>
booking_available_dates.php
<?php
require_once('dbhandler.php');
$dbh = new DBHandler();
if ($dbh->getInstance() === null) {
die("No database connection");
}
try {
$sql = "CALL `booking_dates_available`();";
$stmt = $dbh->getInstance()->prepare($sql);
$stmt->execute();
$dates=$stmt->fetchAll();
}
catch(PDOException $e) {
echo ($e->getMessage());
}
?>
booking_confirm_view.php (not ready - work in progress)
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<form>
<div class="form-group row">
<label for="date" class="col-4 col-form-label">Datum</label>
<div class="col-8">
<input id="date" readonly="readonly" name="date" type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="time" class="col-4 col-form-label">Tid</label>
<div class="col-8">
<input id="time" readonly="readonly" name="time" type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="owner" class="col-4 col-form-label">Båtägare</label>
<div class="col-8">
<input id="owner" name="owner" type="text" class="form-control" required="required">
</div>
</div>
<div class="form-group row">
<label class="col-4">Medlem i HSS?</label>
<div class="col-8">
<div class="custom-control custom-radio custom-control-inline">
<input name="member" id="member_0" type="radio" required="required" class="custom-control-input" value="thru">
<label for="member_0" class="custom-control-label">Medlem</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="member" id="member_1" type="radio" required="required" class="custom-control-input" value="false">
<label for="member_1" class="custom-control-label">Ej medlem</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="boatname" class="col-4 col-form-label">Båtnamn</label>
<div class="col-8">
<input id="boatname" name="boatname" type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="email" class="col-4 col-form-label">E-post</label>
<div class="col-8">
<input id="email" name="email" type="text" class="form-control" required="required">
</div>
</div>
<div class="form-group row">
<label for="mobile" class="col-4 col-form-label">Mobilnummer</label>
<div class="col-8">
<input id="mobile" name="mobile" type="text" class="form-control" required="required">
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<button name="submit" type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
booking_available_time.php
<?php
require_once('dbhandler.php');
$dbh = new DBHandler();
if ($dbh->getInstance() === null) {
die("No database connection");
}
try {
$sql = "CALL `booking_date_input` (:date_input);";
$stmt = $dbh->getInstance()->prepare($sql);
$stmt->bindParam(':date_input', $date_input, PDO::PARAM_STR);
$date_input = $_POST["date_input"];
$stmt->execute();
$result=$stmt->fetchAll();
}
catch(PDOException $e) {
echo ($e->getMessage());
}
?>
$result is the array with the timeslot data.
I am new to StackOverflow but am a great dev.
I was making a HTML Form for my 192.168.1.230 Local Server, but ran into this problem with my html code when I click the submit button (Near the bottom of the code) Pls Help If You Can. I don't think you will need my CSS but ask me if you do and I will reply with all CSS code.
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br><h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" action="../php/search.php" method="post">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
You need to add this action="../php/search.php" method="post" in your form tag
Do this:
<form class="form-horizontal" action="../php/search.php" method="post">
Then change your button for submission to:
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
In your php script, check for subumission like:
<?php
if(isset($_POST['singlebutton'])){//name of button
$password = $_POST['passwordinput']; //
$name = $_POST['textinput'];
$email = $_POST['email'];
//etc. Remember to access the name attribute as it will contain the value from your form
print_r($_POST);//returns associative array(key => value)
}
?>
I see you have a password field, Please do not store passwords in plain text, use php's password_hash
You have to pass action & method attribute on form tag instead of button
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal" action="../php/search.php" method="post">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br>
<h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
So The Working Code Thanks To You Two Is:
<html>
<head>
<title>192.168.1.230 - Become Admin</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<form class="form-horizontal" action="../php/search.php" method="post">
<fieldset>
<!-- Form Name -->
<legend style=text-align:center><br>
<h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Full Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="passwordinput">Password</label>
<div class="col-md-4">
<input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Your Email:</label>
<div class="col-md-4">
<input id="email" name="email" type="text" placeholder="e.g johndoe#gmail.com" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="selectbasic">Gender</label>
<div class="col-md-4">
<select id="selectbasic" name="selectbasic" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
<!-- Button -->
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
</fieldset>
</form>
</html>
Thanks A Lot!
This question already has answers here:
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given... what I do wrong? [duplicate]
(11 answers)
Can I mix MySQL APIs in PHP?
(4 answers)
Reference - What does this error mean in PHP?
(38 answers)
Closed 5 years ago.
this is the code please help me I am connected to the database
so i use mysqli_real_escape_string to get the clear data and save it into my table but it give me a nothing in my data
<?php
$db_connect = mysqli_connect("localhost", "root", "", "master_wn");
if(isset($_POST['send']))
{
session_start();
$name = mysqli_real_escape_string($_POST['name']);
$name2 = mysqli_real_escape_string($_POST['name2']);
$email = mysqli_real_escape_string($_POST['email']);
$case = mysqli_real_escape_string($_POST['case']);
$phone = mysqli_real_escape_string($_POST['phone']);
$adress = mysqli_real_escape_string($_POST['adress']);
$sex = mysqli_real_escape_string($_POST['sex']);
$prove = mysqli_real_escape_string($_POST['prove']);
$quali = mysqli_real_escape_string($_POST['quali']);
$exper = mysql_real_escape_string($_POST['exper']);
$query = "INSERT INTO `stu_data` (`number`,`name`,`name2`,`email`,`phone`,`address`,`sex`,`cases`,`prove`,`quali`,`exper`) VALUES ('','$name','$name2','$email','$phone','$adress','$sex','$case','$prove','$quali','$exper')";
$q = mysqli_query($db_connect,$query);
if ($q){
header("location:step2.php");
}
else
{
"try again";
}
}
?>
<html>
<head>
<title>
test
</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/bootstrap.min.css"/>
<link rel="stylesheet" href="../css/normliaze.css"/>
<link rel="stylesheet" href="../css/style.css"/>
</head>
<body>
<div>
<div class="global">
<!--Star Header-->
<div class="header">
<div class="boy">
<h1>خطوات التقديم لحجز مقعد للدراسات العليا</h1>
<img src="../images/logo.PNG" alt="logo" width="90" height="80">
<p>موقع التقديم للدراسات العليا</p>
</div>
</div>
<!--End Header-->
<div class="holdForm">
<div class="container">
<form class="well form-horizontal" action="step1.php" method="post" id="contact_form">
<fieldset>
<!-- Form Name -->
<legend>الخطوة الاولي </legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">Name</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input placeholder="Name" class="form-control" type="text" name = "name">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" >الاسم</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input placeholder="الاسم بالعربي" class="form-control" type="text" name="name2">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">E-Mail</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input placeholder="E-Mail Address" class="form-control" type="text" name="email">
</div>
</div>
</div>
<!-- radio checks -->
<div class="form-group">
<label class="col-md-4 control-label">الحالة الاجتماعية</label>
<div class="col-md-4">
<div class="radio">
<label>
<input type="radio" name="case" value="marig" /> متزوج
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="case" value="single" /> اعزب
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="case" value="widow" /> ارمل
</label>
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">الهاتف</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input placeholder="(+249)555-1212" class="form-control" type="text" name="phone">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">السكن</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
<input placeholder="Address" class="form-control" type="text" name="adress">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">الجنس</label>
<div class="col-md-4">
<div class="radio">
<label>
<input type="radio" name="sex" value="mail" /> ذكر
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="sex" value="fmail" /> اثتي
</label>
</div>
</div>
</div>
<!-- Text area -->
<div class="form-group">
<label class="col-md-4 control-label">اثبات شخصية</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-file"></i></span>
<input placeholder="Address" class="form-control" type="text" name="prove">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">المؤهل العلمي</label>
<div class="col-md-4 selectContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
<select class="form-control selectpicker" name="quali">
<option value=" " >... اختر مؤهل</option>
<option name="select1">دبلوم عالي</option>
<option name="select2">بكلاريوس</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">سنوات الخبرة</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="exper" placeholder="Address" class="form-control" type="text">
</div>
</div>
</div>
<!-- Success message -->
<div class="alert alert-success" role="alert" id="success_message">Success <i class="glyphicon glyphicon-thumbs-up"></i> Thanks for contacting us, we will get back to you shortly.</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-4">
<input type="submit" class="btn btn-warning glyphicon glyphicon-send" name="send" value="التالي" >
</div>
</div>
</fieldset>
</form>
</div>
</div><!-- /.container -->
</div>
<div id="footer">
<p class="p2">جميع الحقوق محفوظة للمبرمج محمد تاج الدين © 2017-2018</p>
</div><!--end footer-->
</div><!--end all-->
<!--End content-->
<script src="/js/bootstrap.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/plugin.js"></script>
</body>
</html>
this is the code please help me I am connected to the database
so i use mysqli_real_escape_string to get the clear data and save it into my table but it give me a nothing in my data this is the code please help me I am connected to the database
so i use mysqli_real_escape_string to get the clear data and save it into my table but it give me a nothing in my data
i have an issue with my website. I am using bootstrap tabs to navigate through my site. All tabs are working except the last one. He is mixing the content of the last one with the one before.
I am not a coder so i think my code looks horrible. I copied and pasted from different sites. So if you have improvements please let me know.
The .... in the red circle should be underneath the planning tab
<html>
<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>Duiklog</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link href="./bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<h1>Welkom bij mijn duiklog</h1>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active">Home</li>
<li role="presentation">Duiklog</li>
<li role="presentation">Invoer</li>
<li role="presentation">Planning</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<h2>Stats</h2><br>
Aantal duiken: 2<br>
Gemiddeld lucht verbruikt: 22.5000
</div>
<div role="tabpanel" class="tab-pane" id="Duiklog">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>Datum</th>
<th>Locatie</th>
<th>Buddy</th>
<th>Diepte</th>
<th>Duiktijd</th>
<th>Watertype</th>
<th>Zicht</th>
<th>Temp</th>
<th>Duiktype</th>
<th>Fles</th>
<th>Druk start</th>
<th>Druk einde</th>
<th>Druk verbruikt</th>
<th>Lucht verbruikt</th>
<th>Opmerkingen</th>
</tr>
</thead>
<tbody>
<tr><td>2</td><td>2012-05-20</td><td>boschmolenplas</td><td>Harrie Wassen</td><td>11 m </td><td>39 min </td><td>Zoet</td><td>3-6 m </td><td>13 C </td><td>opleiding</td><td>10 l </td><td>200 bar </td><td>10 bar </td><td>190 bar </td><td>23ltr/min </td><td></td></tr><tr><td>1</td><td>2012-05-13</td><td>Panheel</td><td>Harrie Wassen</td><td>9 m </td><td>40 min </td><td>Zoet</td><td>3-6 m </td><td>13 C </td><td>opleiding</td><td>10 l </td><td>210 bar </td><td>40 bar </td><td>170 bar </td><td>22ltr/min </td><td>eerste duik</td></tr></table>
</div>
<div role="tabpanel" class="tab-pane" id="invoer">
<form action="send_post.php" method="post">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="datum">Datum:</label>
<div class="col-sm-10">
<input type="date" class="form-control" name="idatum" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="locatie">Locatie:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ilocatie" placeholder="Voer locatie in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="buddy">Buddy:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ibuddy" placeholder="Voer buddy in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="diepte">Diepte:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idiepte" placeholder="Voer maximale diepte in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="duiktijd">Duiktijd:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="iduiktijd" placeholder="Voer duiktijd in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukstart">Drukstart:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idrukstart" placeholder="Voer begindruk in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukeinde">Drukeinde:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idrukeinde" placeholder="Voer eindedruk in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="watertype">Watertype:</label>
<div class="col-sm-10">
<select class="form-control" name="iwatertype">
<option>Zoet</option>
<option>Zout</option>
<option>Brak</option>
</select>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="zicht">Zicht:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="izicht" placeholder="Voer zicht in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="temperatuur">Temperatuur:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="itemperatuur" placeholder="Voer temperatuur in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="duiktype">Duiktype:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="iduiktype" placeholder="Voer Duiktype in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="flesvolume">Flesvolume:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="iflesvolume" placeholder="Voer flesvolume in">
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="opmerkingen">Opmerkingen:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="iopmerkingen" placeholder="Opmerkingen">
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="planning">
.....
</div>
<div class="container" style="padding-bottom: 75px;">
</div>
<footer class="footer">
<div class="container">
<p class="text-muted">
Connectie met duiklog
<html>
<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>Duiklog</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<body>
<h1>Welkom bij mijn duiklog</h1>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active">Home</li>
<li role="presentation">Duiklog</li>
<li role="presentation">Invoer</li>
<li role="presentation">Planning</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<h2>Stats</h2><br>
Aantal duiken: 2<br>
Gemiddeld lucht verbruikt: 22.5000
</div>
<div role="tabpanel" class="tab-pane" id="Duiklog">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>Datum</th>
<th>Locatie</th>
<th>Buddy</th>
<th>Diepte</th>
<th>Duiktijd</th>
<th>Watertype</th>
<th>Zicht</th>
<th>Temp</th>
<th>Duiktype</th>
<th>Fles</th>
<th>Druk start</th>
<th>Druk einde</th>
<th>Druk verbruikt</th>
<th>Lucht verbruikt</th>
<th>Opmerkingen</th>
</tr>
</thead>
<tbody>
<tr><td>2</td><td>2012-05-20</td><td>boschmolenplas</td><td>Harrie Wassen</td><td>11 m </td><td>39 min </td><td>Zoet</td><td>3-6 m </td><td>13 C </td><td>opleiding</td><td>10 l </td><td>200 bar </td><td>10 bar </td><td>190 bar </td><td>23ltr/min </td><td></td></tr><tr><td>1</td><td>2012-05-13</td><td>Panheel</td><td>Harrie Wassen</td><td>9 m </td><td>40 min </td><td>Zoet</td><td>3-6 m </td><td>13 C </td><td>opleiding</td><td>10 l </td><td>210 bar </td><td>40 bar </td><td>170 bar </td><td>22ltr/min </td><td>eerste duik</td></tr></table>
</div>
<div role="tabpanel" class="tab-pane" id="invoer">
<form action="send_post.php" method="post">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="datum">Datum:</label>
<div class="col-sm-10">
<input type="date" class="form-control" name="idatum" >
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="locatie">Locatie:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ilocatie" placeholder="Voer locatie in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="buddy">Buddy:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ibuddy" placeholder="Voer buddy in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="diepte">Diepte:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idiepte" placeholder="Voer maximale diepte in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="duiktijd">Duiktijd:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="iduiktijd" placeholder="Voer duiktijd in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukstart">Drukstart:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idrukstart" placeholder="Voer begindruk in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukeinde">Drukeinde:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="idrukeinde" placeholder="Voer eindedruk in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="watertype">Watertype:</label>
<div class="col-sm-10">
<select class="form-control" name="iwatertype">
<option>Zoet</option>
<option>Zout</option>
<option>Brak</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="zicht">Zicht:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="izicht" placeholder="Voer zicht in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="temperatuur">Temperatuur:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="itemperatuur" placeholder="Voer temperatuur in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="duiktype">Duiktype:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="iduiktype" placeholder="Voer Duiktype in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="flesvolume">Flesvolume:</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="iflesvolume" placeholder="Voer flesvolume in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="opmerkingen">Opmerkingen:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="iopmerkingen" placeholder="Opmerkingen">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="planning">
this is working
</div>
Check this code this is working code and for more please follow the link
http://quandaflow.com/category/website/css/
Your html code had a lot of errors, unclosed tags etc.. The following code is the valid version of what you are trying to do:
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab"
data-toggle="tab">Home</a></li>
<li role="presentation">Duiklog</li>
<li role="presentation">Invoer</li>
<li role="presentation">Planning
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<h2>Stats</h2>
<br> Aantal duiken: 2
<br> Gemiddeld lucht verbruikt: 22.5000
</div>
<div role="tabpanel" class="tab-pane" id="Duiklog">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>Datum</th>
<th>Locatie</th>
<th>Buddy</th>
<th>Diepte</th>
<th>Duiktijd</th>
<th>Watertype</th>
<th>Zicht</th>
<th>Temp</th>
<th>Duiktype</th>
<th>Fles</th>
<th>Druk start</th>
<th>Druk einde</th>
<th>Druk verbruikt</th>
<th>Lucht verbruikt</th>
<th>Opmerkingen</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>2012-05-20</td>
<td>boschmolenplas</td>
<td>Harrie Wassen</td>
<td>11 m</td>
<td>39 min</td>
<td>Zoet</td>
<td>3-6 m</td>
<td>13 C</td>
<td>opleiding</td>
<td>10 l</td>
<td>200 bar</td>
<td>10 bar</td>
<td>190 bar</td>
<td>23ltr/min</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>2012-05-13</td>
<td>Panheel</td>
<td>Harrie Wassen</td>
<td>9 m</td>
<td>40 min</td>
<td>Zoet</td>
<td>3-6 m</td>
<td>13 C</td>
<td>opleiding</td>
<td>10 l</td>
<td>210 bar</td>
<td>40 bar</td>
<td>170 bar</td>
<td>22ltr/min</td>
<td>eerste duik</td>
</tr>
</table>
</div>
<div role="tabpanel" class="tab-pane" id="invoer">
<form action="send_post.php" method="post" class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="datum">Datum:</label>
<div class="col-sm-10">
<input id="datum" type="date" class="form-control" name="idatum">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="locatie">Locatie:</label>
<div class="col-sm-10">
<input id="locatie" type="text" class="form-control" name="ilocatie"
placeholder="Voer locatie in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="buddy">Buddy:</label>
<div class="col-sm-10">
<input id="buddy" type="text" class="form-control" name="ibuddy" placeholder="Voer buddy in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="diepte">Diepte:</label>
<div class="col-sm-10">
<input id="diepte" type="number" class="form-control" name="idiepte"
placeholder="Voer maximale diepte in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="duiktijd">Duiktijd:</label>
<div class="col-sm-10">
<input id="duiktijd" type="number" class="form-control" name="iduiktijd"
placeholder="Voer duiktijd in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukstart">Drukstart:</label>
<div class="col-sm-10">
<input id="drukstart" type="number" class="form-control" name="idrukstart"
placeholder="Voer begindruk in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="drukeinde">Drukeinde:</label>
<div class="col-sm-10">
<input id="drukeinde" type="number" class="form-control" name="idrukeinde"
placeholder="Voer eindedruk in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="watertype">Watertype:</label>
<div class="col-sm-10">
<select id="watertype" class="form-control" name="iwatertype">
<option>Zoet</option>
<option>Zout</option>
<option>Brak</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="zicht">Zicht:</label>
<div class="col-sm-10">
<input id="zicht" type="text" class="form-control" name="izicht"
placeholder="Voer zicht in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="temperatuur">Temperatuur:</label>
<div class="col-sm-10">
<input id="temperatuur" type="number" class="form-control" name="itemperatuur"
placeholder="Voer temperatuur in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="duiktype">Duiktype:</label>
<div class="col-sm-10">
<input id="duiktype" type="text" class="form-control" name="iduiktype"
placeholder="Voer Duiktype in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="flesvolume">Flesvolume:</label>
<div class="col-sm-10">
<input id="flesvolume" type="number" class="form-control" name="iflesvolume"
placeholder="Voer flesvolume in">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2"
for="opmerkingen">Opmerkingen:</label>
<div class="col-sm-10">
<input id="opmerkingen" type="text" class="form-control"
name="iopmerkingen" placeholder="Opmerkingen">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">
Submit
</button>
</div>
</div>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="planning">
.....
</div>
</div>
</div>
<html>
<head>
<title>
Installation
</title>
<script src="public/js/jquery-1.9.0.min.js"></script>
<script src="public/js/bootstrap3/js/bootstrap.js"></script>
<link media="all" type="text/css" rel="stylesheet" href="public/js/bootstrap3/css/bootstrap.min.css">
<link media="all" type="text/css" rel="stylesheet" href="public/js/bootstrap3/css/font-awesome.min.css">
<link media="all" type="text/css" rel="stylesheet" href="public/js/bootstrap3/css/main.css">
</head>
<body>
<div
class="navbar navbar-default navbar-fixed-top">
<div
class="container">
<div
class="navbar-header">
<button
type="button"
class="navbar-toggle"
data-toggle="collapse"
data-target=".navbar-collapse">
<span
class="icon-bar"></span>
<span
class="icon-bar"></span>
<span
class="icon-bar"></span>
</button>
<a
class="navbar-brand"
href="<?php // echo base_url()?>">Kingpabel
ATN</a>
</div>
<div
class="navbar-collapse collapse">
</div>
<!--/.nav-collapse -->
</div>
</div>
<div
class="rc">
<div
class="container main">
<div
class="col-md-3">
</div>
<div
class="col-md-6">
<form
method="post"
accept-charset="utf-8"
role="form"
class="form- signin form-horizontal">
<h2
class="form-signin-heading">Installation</h2>
<div
style="margin-top: 20px;">
<label
for="host_name"
class="col-sm-3 control-label"
style="color: black">
Host
Name
</label>
<div
class="input text database_host col-md-9">
<input
type="text"
name="host_name"
class="form-control"
placeholder="Database Host Name"
autofocus=""
required="required"
id="host_name">
</div>
</div>
<div>
<label
for="database_name"
class="col-sm-3 control-label"
style="color: black">
Database
Name
</label>
<div
class="input text database_name col-md-9">
<input
type="text"
name="database_name"
class="form-control"
placeholder="Database Name"
autofocus=""
required="required"
id="database_name">
</div>
</div>
<div>
<label
for="user_name"
class="col-sm-3 control-label"
style="color: black">
User
Name
</label>
<div
class="input text user_name col-md-9">
<input
type="text"
name="user_name"
class="form-control"
placeholder="Database User Name"
autofocus=""
required="required"
id="user_name">
</div>
</div>
<div>
<label
for="password"
class="col-sm-3 control-label"
style="color: black">
Password
</label>
<div
class="input text password col-md-9">
<input
type="password"
name="password"
class="form-control"
placeholder="Database Password"
autofocus=""
id="password">
</div>
</div>
<div>
<label
for="project_url"
class="col-sm-3 control-label"
style="color: black">
Project
Url
</label>
<div
class="input text project_url col-md-8 input-group input-group-sm">
<input
style=" margin-left: 13px;"
type="text"
name="project_url"
class="form-control"
placeholder="Project URL"
autofocus=""
id="project_url"
aria-describedby="basic-addon2">
<span
class="input-group-btn">
<button
class="btn btn-default"
type="button"
style="margin-top: -15px;">/public</button>
</span>
</div>
</div>
<button
type="submit"
class="btn btn-lg btn-login btn-block">Install</button>
</form>
</div>
</div>
</div>
<section
id="bottom"
style="margin-top: 50px">
</section>
<footer
id="footer">
<div
class="container">
<div
class="footer">
<div
class="row">
<div
class="col-md-12">
</div>
</div>
</div>
</div>
</footer>
</body>
</html>
<?php
if ($_POST) {
$envFile = file_get_contents('.env');
if (isset($_POST['host_name']) && $_POST['host_name'])
$envFile = str_replace('DB_HOST=localhost', "DB_HOST= {$_POST['host_name']}", $envFile);
if (isset($_POST['database_name']) && $_POST['database_name'])
$envFile = str_replace('DB_DATABASE=homestead', "DB_DATABASE={$_POST['database_name']}", $envFile);
if (isset($_POST['user_name']) && $_POST['user_name'])
$envFile = str_replace('DB_USERNAME=homestead', "DB_USERNAME={$_POST['user_name']}", $envFile);
if (isset($_POST['password']) && $_POST['password'])
$envFile = str_replace('DB_PASSWORD=secret', "DB_PASSWORD={$_POST['password']}", $envFile);
file_put_contents('.env', $envFile);
if (isset($_POST['project_url']) && $_POST['project_url']) {
file_get_contents('index.php');
file_put_contents('index.php', "<?php
header('Location: {$_POST['project_url']}/public');
");
}
}`
In above code, after submitting the form, the idex.php is rewriiten and changes. And i wanted to redirect to another page after submitting the form. But it is not being redirected.
Not sure what all your block of codes are for but perhaps try this..
On your
if (isset($_POST['project_url']) && $_POST['project_url']) {
file_get_contents('index.php');
file_put_contents('index.php', "<?php
header('Location: {$_POST['project_url']}/public');
");
}
change to
if (isset($_POST['project_url']) && $_POST['project_url']) {
$url = $_POST['project_url'] + '/public';
header('Location: $url');
}