Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Fala Galera.
Novamente eu aqui pedindo ajuda a vcs.
Tenho um formulário de cadastro e preciso inserir nela as funções strtoupper e strtolower, mas não sei aonde exatamente inserir essas funções!
Vou postar o fonte do formulário e espero que vcs possam me ajudar.
São 3 campos de texto:
1º - LOGIN = (TODO EM CAIXA ALTA)
2º - SENHA = (DA MANEIRA QUE FOR DIGITADO)
3º - EMAIL = (TODO EM CAIXA BAIXA)
Se alguem tiver noção disso fico no aguardo.
Valew Galera...
Abraços
<?php require_once('../Connections/conTeste.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
/*$insertSQL = sprintf("INSERT INTO teste (LOGIN, SENHA, EMAIL) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['txtUsuario'], "text"),
GetSQLValueString($_POST['txtSenha'], "text"),
GetSQLValueString($_POST['txtEmail'], "text"));*/
$insertSQL = sprintf("INSERT INTO teste (LOGIN, SENHA, EMAIL) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['txtUsuario'], "text"),
GetSQLValueString($_POST['txtSenha'], "text"),
GetSQLValueString($_POST['txtEmail'], "text"));
mysql_select_db($database_conTeste, $conTeste);
$Result1 = mysql_query($insertSQL, $conTeste) or die(mysql_error());
$insertGoTo = "teste2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sem título</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="270">
<tr>
<td width="118" align="right">Usuário:</td>
<td width="140"><label>
<input type="text" name="txtUsuario" id="txtUsuario" />
</label></td>
</tr>
<tr>
<td align="right">Senha:</td>
<td><label>
<input type="password" name="txtSenha" id="txtSenha" />
</label></td>
</tr>
<tr>
<td align="right">E-mail:</td>
<td><label>
<input type="text" name="txtEmail" id="txtEmail" />
</label></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right"><input type="submit" name="button" id="button" value="Enviar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>Carregando comentários...