Hocam çok teşekkür ederim. Bir türlü çözemediğim bir sorundu, sayenizde nasıl yapılacağını öğrendim.
Not: Php ve javascript de 40 yaşından sonra merak salan, acemi biriyim. :))
Hocam submit buttonuna basınca veritabanına kayıt ediyor fakat sadece bir adet id yi.
Bir yerde hata yapıyorum ama malesef göremiyorum.
Öncelikle cevabınız için teşekkürler.
Yazdığınız gibi denediğim zaman
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null
hatasını aldım ve Mysql e kayıt edtmedi.
id leri veritabanındaki başka bir tablodan çekiyorum
$id = post('id');
$mesaj = post('mesaj');
almaya çalışıyorum.
Arkadaşlar tekrar merhaba,
Sorunumu çözdüm, belki benim gibi acemi arakaşlarında bir gün işine yarar diye kodu yazıyorum.
<?php require_once('Connections/connect.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;
}
}
mysql_select_db($database_connect, $connect);
$query_rapor = "SELECT * FROM rapor where id =84";
$rapor = mysql_query($query_rapor, $connect) or die(mysql_error());
$row_rapor = mysql_fetch_assoc($rapor);
$totalRows_rapor = mysql_num_rows($rapor);
?>
<!DOCTYPE html>
<html>
<head>
<title>Rapor Onay</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" ></script>
</head>
<body>
<button type="button" id="buton" >Rapor yaz </button>
<script type="text/javascript">
$sayi=<?php echo $row_rapor['durum']; ?>
deneme=($sayi);
if (deneme==1)
{
document.getElementById("buton").disabled = false;
}
else
{
document.getElementById("buton").disabled = true;
}
</script>
</body>
</html>
<?php
mysql_free_result($rapor);
?>
Aktif ve pasif yerlere nasıl bir cod yazmalıyım ? teşekkürler
<button type="button" value="" >giris</button>
<?php
$deneme ='5';
if ($deneme==1) {
// Buton aktif
} else {
// Buton pasif
}
?>