my problem is following:
I am using this code to pass a value to a different file called "benutzerstart.php". Debugging through the jquery shows, that the value in "var beta" is correct.
I do get a problem with getting the value to a PHP variable.
The error code is : "Notice: Undefined index: param in C:\\xampp\\htdocs\\KVP\\benutzerstart.php on line 76"
Referring to the error code my suggestion is that the passed value is not really passed to the php file.
JQuery code:
<script>
$('#form').submit(function() {
var arrayFromPHP = <?php echo json_encode($Email) ?>;
var newMail = $.trim($('#Email').val())
var pw1 = $.trim($('#Password').val())
var mailVorhanden = false;
var pwRichtig = false;
var idVondemShit = -1;
var tempindex = -1;
for ( var i = 0; i < arrayFromPHP.length; i++ ) {
// $.each(arrayFromPHP, function (i, val) {
if(newMail === arrayFromPHP[i].Email ){
mailVorhanden = true;
tempindex = i;
break;
}
};
if (mailVorhanden === true)
{
if(pw1 === arrayFromPHP[tempindex].pw)
{
idVondemShit = arrayFromPHP[tempindex].idName;
pwRichtig = true;
if(arrayFromPHP[tempindex].mode === "1")
{
location.href='startseite.html';
pwRichtig = false;
}
}
else
{
alert('Passwort oder Nutzername falsch.');
}
}
else{
alert('Passwort oder Nutzername falsch.');
}
var beta = arrayFromPHP[tempindex].idName
$.ajax({
url: 'benutzerstart.php',
data: {'param' : 'beta'},
});
return pwRichtig
});
</script>
PHP code from "benutzerstart.php":
<?php
// Collect data
mysql_connect("localhost", "root" , "Floradix94");
mysql_select_db("hallo");
$tstID = $_GET['param'];
$sql= "SELECT erfassung.Verbesserungsvorschlag,erfassung.megusta,login.Email,erfassung.id,erfassung.Betre ff FROM (erfassung INNER JOIN login ON erfassung.loginid=login.loginid)";
$query=mysql_query($sql) or die (mysql_error());
while($row = mysql_fetch_assoc($query)) {
$modals[] = array(
'id' => 'modal' . $row['id'],
'href' => '#modal' . $row['id'],
'FormDoneId' => $row['id'] . 'FormDoneId',
'Email' =>$row['Email'],
'Verbesserungsvorschlag' => $row['Verbesserungsvorschlag'],
'megusta' => $row['megusta'],
'betreff' => $row['Betreff'],
);
}
?>
Anyone got an idea?
Change this
data: {'param' : 'beta'},
To
data: {param : 'beta'},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.