We help IT Professionals succeed at work.
Get Started

code is giving warning like Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newdom.php:137) in C:\xampp\htdocs\newdom.php on line 164

shruti A
shruti A asked
Last Modified: 2017-03-30
<!DOCTYPE html>
<html lang="en">
		<title>Bootstrap Example</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<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>
		<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> 
		<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/css/select2.min.css" rel="stylesheet"/> 
		<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js"></script> 
	<style type="text/css">
		.table {
			margin: 0 auto;
			width: 50%;
			/*opacity: ;*/
	<form class="form-horizontal" name="form" role="form" method="post" action="" onclick="validator()">
	<table class="table">
				<th>Enter Field Name<span class="label label"> <td><input id="new-state" type="text" placeholder="Field Name "/>
				<td><button type="button" id="btn-add-state">ADD</button></td></tr>
				<th>Select Field Name <span class="label label"> <td>
							<select id="state" class="selectpicker" type="text" style="width:150px" name="column" required="" align="left">
								<option value="">select</option>
								<option value="col1">col1</option>
								<option value="col2">col2</option>

				<th>Select Field type<span class="label label"><td>
							<select id="type1" class="selectpicker" type="text" style="width:150px" name="type" required="">
								<option value="">select</option>
								<option value="INT">INT</option>
								<option value="VARCHAR">VARCHAR</option>

					<span>How do you pass values:</span></th>    <td>
					<select id="type2" class="selectpicker" type="text" style="width:150px"  name="value" required="" onselect="select();">
						<option value="">select</option>
						<option value="Custom Values"  id="chkYes">Custom Values</option>
						<option value=" Static Values"  id="chkNo"> Static Values</option>
		<td><div id="dvPassport" style="display: none">
			Custom Values:
			<input id="value" type="text" placeholder=" Enter Value " name="value" required="" />
		<div id="dPassport" style="display: none">
			Static Values:
			<select id="value" class="selectpicker" type="text" style="width:150px" name="value" required="" align="left">
				<option value="">select</option>
				<option value="state">State</option>
				<option value="District">District</option>
				<option value="Gender">Gender</option>
				<option value="B-group">B-group</option>
			<input type="submit" value="SUBMIT" class="btn btn-success"  name="submit" />


		<td><input id="remove" type="button" value="Done" onclick="myFunction()"></td></tr>
<script type="text/javascript">
	$(document).ready(function () {
		function select() {
			if ($('#type2').find(":selected").attr('id') == 'chkYes') {
			} else {
		//this makes the select change call the function select():
		// anytime the user change the selection the function select() is called and works as expected
		$('#type2').on('change', function () {

			tags: true

		$("#btn-add-state").on("click", function () {
			var newStateVal = $("#new-state").val();
			// Set the value, creating a new option if necessary
			if ($("#state").find("option[value='" + newStateVal + "']").length) {
			} else {
				// Create the DOM option that is pre-selected by default
				var newState = new Option(newStateVal, newStateVal, true, true);
				// Append it to the select
			tags: true

	});//end jQuery
	<script type="text/javascript">
$(document).ready(function() {
      tags: true
$link = mysqli_connect("localhost","root","")  or die("failed to connect to server !!");
$errorMessage = "";

// Validation will be added here
if ($errorMessage != "" ) {
echo "<p class='message'>" .$errorMessage. "</p>" ;
//Inserting record in table using INSERT query
$ins="INSERT INTO `idcard`.`combo1`
(`column`, `type`, `value`) VALUES ('$column', '$type', 
$test=mysqli_query($link,$ins) or die(mysqli_error($link));
echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
 echo "<script type='text/javascript'>alert('failed!')</script>";


Open in new window


Its giving warning about header information why it is don't know i have tried lot and its not  taking from  how do you pass field in that only static values are inserting but custom values are not inserting why don't know please help me to solve this problem.....Doc1.docx
Watch Question
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE