OK. My 'logincontainer is hard coded HTML in the index.html page and is shown when a 'placeorder' button is clicked. The client enters their e-mail address in the only input visible and javascript addevent onchange checks to see if it is a valid e-mail or not. Above the input id 'login' is a span tag id 'loginrequest' which serves as server responceText. When the 'login.value' is a valid email address the second input is made visible id 'pass'. The 'pass' input addevent onchange query's the database with 'SELECT id FROM members WHERE login= '".($login)."' AND pass='".($pass)."'". The problem is
ResponceText span id 'loginrequest'
Parse error: syntax error, unexpected $end in D:\use_ide_1\UniServer\www\getmember.php on [B]line 26[/B]
MyDb Members Table Columns
id|status|started|name|login
Ajax call in index.js
var emailformat=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
var lrq=document.getElementById('loginrequest');
var login=document.getElementById('login');
var passwordlist=document.getElementById('passwordlist');
var temail=document.getElementById('temail');//html table cell written to
function logincheck(){
var p=login.value;
if(p==' '){
lrq.innerHTML='Please Enter Your E-mail Address to login and register.';
return false;
}
if(emailformat.test(p)){
lrq.innerHTML='Please enter Your password.';
temail.innerHTML=p;
passwordlist.className='show';
return false;
}
else{
lrq.innerHTML='Please Enter a Valid E-mail address.';
return true;//works
}}
addEvent(login,'change',function(){logincheck();},false);
var pass=document.getElementById('pass');
function getmember(p){
if(p==' '){//if 'pass.value' is empty?
lrq.innerHTML=' ';
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else{// code for IE6, IE5
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
lrq.innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open('GET','members.php?q='+p,true);//+p being 'pass.value'? no +e login.value?
xmlhttp.send();
}
addEvent(pass,'focus',function(){lrq.innerHTML='Minimum 8 characters, Maximum 12.';},false);
addEvent(pass,'change',function(){
var e=login.value;
var p=pass.value;
getmember(p);//Ajax call
},false);
getmember.php
1. <?php
2. $q=$_GET["q"];//p or 'pass.value' variable? no 'e' or 'login.value'
3. $link=mysql_connect("localhost","root","root")or die(mysql_error( ));
4. mysql_select_db("bwi",$link) or die(mysql_error( ));
5. $query=mysql_query("SELECT id FROM members WHERE login= '".($login)."'
6. AND pass='".($pass)."'")or die(mysql_error());
7. if($query_num_rows==0){
8. echo 'You must register';//responceText gets the echo?
9. }
10. else if($query_num_rows ==1){
11. while($row = mysql_fetch_array($query))
12. {
13. echo "Welcome back " . $row['name'] . ". You may change relevant items.";
14. }
15. mysql_close($link);
16. ?>
//no line 26?
I've got quite an elegant get php that returns beautiful html to a main display div from MyDb but post is probably smarter and the 'SELECT id FROM members' syntax is the issue. Please help me if you can. I can't get the gist of the other posts as they involve starting sessions etc.:'(