Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ola galera!
Estou desenvolvendo um sitema para empresa onde trabalho. Nao tenho muita esperiencia em PHP+Mysql porem consegui muita coisa ja!
Porem agora estou com o trabalho parado a 3 dias pois preciso fazer uma BUSCA entre um determinado periodo!
Seria uma pagina em php com dois campos para ele digitar a data inicial e a data final e um submit para buscar isso em banco, mas não estou conseguindo fazer isso.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type=text/javascript>
documentall = document.all;function formatamoney(c) {
var t = this; if(c == undefined) c = 2;
var p, d = (t=t.split("."))[1].substr(0, c);
for(p = (t=t[0]).length; (p-=3) >= 1;) {
t = t.substr(0,p) + "." + t.substr(p);
}
return t+"."+d+Array(c+1-d.length).join(0);
}
String.prototype.formatCurrency=formatamoney
function demaskvalue(valor, currency){
/*
* Se currency é false, retorna o valor sem apenas com os números. Se é true, os dois últimos caracteres são considerados as
* casas decimais
*/
var val2 = '';
var strCheck = '0123456789';
var len = valor.length;
if (len== 0){
return 0.00;
}
if (currency ==true){
/* Elimina os zeros à esquerda
* a variável <i> passa a ser a localização do primeiro caractere após os zeros e
* val2 contém os caracteres (descontando os zeros à esquerda)
*/
for(var i = 0; i < len; i++)
if ((valor.charAt(i) != '0') && (valor.charAt(i) != ',')) break;
for(; i < len; i++){
if (strCheck.indexOf(valor.charAt(i))!=-1) val2+= valor.charAt(i);
}
if(val2.length==0) return "0.00";
if (val2.length==1)return "0.0" + val2;
if (val2.length==2)return "0." + val2;
var parte1 = val2.substring(0,val2.length-2);
var parte2 = val2.substring(val2.length-2);
var returnvalue = parte1 + "." + parte2;
return returnvalue;
}
else{
/* currency é false: retornamos os valores COM os zeros à esquerda,
* sem considerar os últimos 2 algarismos como casas decimais
*/
val3 ="";
for(var k=0; k < len; k++){
if (strCheck.indexOf(valor.charAt(k))!=-1) val3+= valor.charAt(k);
}
return val3;
}
}
function reais(obj,event){
var whichCode = (window.Event) ? event.which : event.keyCode; event.preventDefault();
}else{ // internet explorer
event.returnValue = false;
}
var valor = obj.value;
var x = valor.substring(0,valor.length-1);
obj.value= demaskvalue(x,true).formatCurrency();
return false;
}function backspace(obj,event){
/*
Essa função basicamente altera o backspace nos input com máscara reais para os navegadores IE e opera.
O IE não detecta o keycode 8 no evento keypress, por isso, tratamos no keydown.
Como o opera suporta o infame document.all, tratamos dele na mesma parte do código.
*/
var whichCode = (window.Event) ? event.which : event.keyCode;
if (whichCode == 8 && documentall) {
var valor = obj.value;
var x = valor.substring(0,valor.length-1);
var y = demaskvalue(x,true).formatCurrency();
obj.value =""; //necessário para o opera
obj.value += y;
if (event.preventDefault){ //standart browsers
event.preventDefault();
}else{ // internet explorer
event.returnValue = false;
}
return false;
}// end if
}// end backspace
function FormataReais(fld, milSep, decSep, e) {
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
//if (whichCode == 8 ) return true; //backspace - estamos tratando disso em outra função no keydown
if (whichCode == 0 ) return true;
if (whichCode == 9 ) return true; //tecla tab
if (whichCode == 13) return true; //tecla enter
if (whichCode == 16) return true; //shift internet explorer
if (whichCode == 17) return true; //control no internet explorer
if (whichCode == 27 ) return true; //tecla esc
if (whichCode == 34 ) return true; //tecla end
if (whichCode == 35 ) return true;//tecla end
if (whichCode == 36 ) return true; //tecla home
/*
O trecho abaixo previne a ação padrão nos navegadores. Não estamos inserindo o caractere normalmente, mas via script
*/
if (e.preventDefault){ //standart browsers
e.preventDefault()
}else{ // internet explorer
e.returnValue = false
}
var key = String.fromCharCode(whichCode); // Valor para o código da Chave
if (strCheck.indexOf(key) == -1) return false; // Chave inválida
/*
Concatenamos ao value o keycode de key, se esse for um número
*/
fld.value += key;
var len = fld.value.length;
var bodeaux = demaskvalue(fld.value,true).formatCurrency();
fld.value=bodeaux;
/*
Essa parte da função tão somente move o cursor para o final no opera. Atualmente não existe como movê-lo no konqueror.
*/
if (fld.createTextRange) {
var range = fld.createTextRange();
range.collapse(false);
range.select();
}
else if (fld.setSelectionRange) {
fld.focus();
var length = fld.value.length;
fld.setSelectionRange(length, length);
}
return false;
}
</SCRIPT>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script>
function formatar(src, mask) var i = src.value.length;
var saida = mask.substring(0,1);
var texto = mask.substring(i) src.value += texto.substring(0,1);
}
}
</script>
<script language="JavaScript">uCase = qual.value.toUpperCase();
qual.value = uCase;
}</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="3%"><span class="style13 style13"><img src="Imagens/cadeado.gif" alt="" width="30" height="30" /></span></td>
<td width="97%"><strong><b><strong>Free Travel Turismo</strong></b> - <b><b><a href="fechar.php">Fechar Janela</a></b></b></strong></td>
</tr>
<tr>
<td> </td>
<td><table width="482" border="0">
<tr>
<td width="177"><span class="style7 style13 style13">Localizar Reservas por periodo:</span></td>
<td width="19">DE:</td>
<td width="60"><input name="data1" type="text" id="data1" onkeypress="formatar(this, '##/##/####')" size="10" maxlength="10" /></td>
<td width="10">Á</td>
<td width="255"><label>
<input name="data2" type="text" id="data2" onkeypress="formatar(this, '##/##/####')" size="10" maxlength="10" />
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><div align="left"> <span class="style7 style13 style13">
<input type="submit" name="button" id="button" value="Localizar" />
</span></div></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>Desde ja agradeço.
Carregando comentários...