<?php
	$con=mysql_connect("localhost","root","") or die("Failed to connect with database!!!!");

	mysql_select_db("bancoteste", $con); 
	$sth = mysql_query("SELECT * FROM linguagens");

?>



<!DOCTYPE html>
<html>
	<head>
		<title>bselect</title>
		<meta charset="UTF-8" />

		<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" />
		<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet/less" href="src/bselect.less" />
		<link rel="stylesheet" href="support/styles/prettify.css" />

		<!--[if lte IE 8]>
		<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
		<![endif]-->

		<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/1.3.3/less.min.js"></script>
		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
		<script src="src/bselect.js"></script>
		<script src="support/scripts/prettify.js"></script>
		<script src="support/scripts/example.js"></script>
  		<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

	</head>
	<body>
		<div class="container">

				<br>

				<div class="span6">
					<label for="bselect-standard">PHP:</label>
					
					<select class="languages span" id="bselect-standar">
						<option value="">Selecione</option>

						<?php
							while($r = mysql_fetch_assoc($sth)) {
									echo "<option value='".$r['id']."'>".$r['tipo']."</option>";
								}
						?> 
					</select>
				</div>


			</div>



			<!-- Modal -->
			<div id="myModal" class="modal fade" role="dialog">
			  <div class="modal-dialog">

			    <!-- Modal -->
			<div id="myModal" class="modal fade" role="dialog">
			  <div class="modal-dialog">
			  	
			  	<form action="enviar.php" method="post">
			  		
			  		<!-- Modal content-->
				    <div class="modal-content">
				      <div class="modal-header">
				        <button type="button" class="close" data-dismiss="modal">&times;</button>
				        <h4 class="modal-title">Cadastrar Nova Entrada</h4>
				      </div>
				      <div class="modal-body">
				        <p>Nome Pessoa</p>
				        <input type="text" name="nomePessoa" id="nomePessoa">
				      </div>
				      <div class="modal-footer">
				      	<button type="submit" class="btn btn-success" >Save</button>
				        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				      </div>
				    </div>

			  	</form>
			    

			  </div>
			</div>

			  </div>
			</div>

	</body>
</html>


<?php

	$nomePessoa = $_POST['nomePessoa'];

	$con=mysql_connect("localhost","root","") or die("Failed to connect with database!!!!");

	mysql_select_db("bancoteste", $con); 

	$string = "INSERT INTO pessoa (nomePessoa) VALUES ('".$nomePessoa."')";

	$query = mysql_query($string);

	if($query == TRUE){
		echo "Inserido com Sucesso";
		hea[]
	}
	else{
	   echo "Erro ao inserir";
	}

?>