Ich bin neu in PHP und ich mache ein PHP, wo zuerst eine Variable und finden Sie eine Variable aus der Datenbank (arithmos_ff) und nach dem Ausführen der HTML-Code (die in der gleichen Datei mit aithsh .php code) und nehme einen zweiten Beitrag davon, ich möchte es mit "arithmos_ff" vergleichen. Aber "Undefined index: arithmos_ff" nach dem Senden mit Post die zweite Variable angezeigt. Wie kann ich die erste Variable behalten und sie nach dem zweiten Post verwenden? Vielen Dank im Voraus! `Behalten Sie den globalen Wert nach dem zweiten POST
<?php
$connect=mysqli_connect('localhost','root','','project');
if($connect->connect_error)
{
\t \t die('Failed to connect');
}
else {echo 'connect worked';}
\t $_SESSION['titlos'] = $_GET["value"];//take the first variable
$titlos=$_SESSION['titlos'];
echo"<br>Ο αιτούμενος επιθυμεί να λάβει την διπλωματική με τίτλο ".$titlos ;
$sql2="SELECT ar_foithtwn FROM diplwmatikh WHERE find_in_set('$titlos',title) > 0";
$result3=$connect->query($sql2);
if(mysqli_num_rows($result3)){
\t while($row1=$result3->fetch_assoc()){
\t \t
\t \t $GLOBALS['arithmos_ff']=$row1['ar_foithtwn'];
//arithmos_ff=i want to keep it!
\t \t echo" <br>o arithmos foithtwn pou epitrepetai nanalavoun thn diplwmatikh einai :".$row1['ar_foithtwn'];
}
}
if (isset($_POST['number'])){//this is the second post that get from html
$GLOBALS['arithmos']=$_POST['arithmos'];
check_number();
//and i want to compare 'arithmos' with 'arithmos_ff' in this function
}
function check_number() {//to use it in this function after second post
if( $GLOBALS['arithmos']== $GLOBALS['arithmos_ff']){
\t echo"<br>Ο αριθμός των φοιτητών που προβλέπεται να την αναλάβουν είναι ο επιθυμητός : ".$GLOBALS['arithmos'] ;
\t $sql="UPDATE diplwmatikh SET katastash=2 WHERE find_in_set('$titlos',title) > 0";
if(mysqli_query($connect,$sql)){
echo "<br>Update η κατασταση της διπλωματικης σε 2(υπο έγκριση).";
\t
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($connect);
}
}}
\t
\t
?> `
Sie es in Sitzungen – Ghost
i am besten denken könnte sparen – JYoThI