Jump to content
Larry Ullman's Book Forums

Jackie

Members
  • Posts

    5
  • Joined

  • Last visited

Jackie's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. It's a simple site using most of what the first book had to offer. I register users, login, add records, look at records, and allow a user to get more information by taking the record...users are charged points so records are updated and added. users are given points when they supply information so records are edited. I'm using php and mysql. I'm thinking I need to update to mysqli - I'm editing using notepad++ and uploading to a godaddy server to test my changes and site.
  2. I've been reading and applying PHP and MYSQL - second edition - to a website I've been creating...is there a suggestion on what book I should get next - is there added information in the latest edition that would make it worth purchasing? Does the advanced php book use mysql where I could apply new ideas to my current site? Also, any suggestion for a good HTML book? I've nearly finished my website using what I remember from a class I took and a book that goes back even farther published in 1997! It would be nice to have a reference book that was uptodate.
  3. I have a headers file that displays the menu. then click on signin.php to get to the page I sent you above. I get the "headers already sent" everywheare on the page...question: if I am looking at the webpage displayed from the code above - are headers "active" at that time? Is there a header that has already been sent from the previous page? If so, how do you every get around that? When I enter a valid email and password and press submit - headers have already been sent, I just don't know where from. my diagnostic check right after "If Submitted" already there. the only html on the page is for the form. Any ideas?
  4. thank you so much for looking at this...below is the code. question: there is no html on this page except for the form...where is the header coming from? I even took out the include for my headers page. question: can headers come from previous pages? <?php if (headers_sent()) { echo "<p>headers sent before submit</p>";} //diagnostic to determing where the headers were coming in if (isset($_POST['submitted'])) //submitted test AA { if (headers_sent()){ echo "<p> header sent inside submitted</p>";} //diagnostic again - and I am always seeing this line require_once ('./mysqlconnection.php'); $errors = array(); //initialize error array. //check for project email address if (empty($_POST['userid'])) { $errors[] = 'Please enter your email address'; } else { $em = escape_data ($_POST['userid']); } //check for password if (empty($_POST['password'])) { $errors[] = 'Please enter a password'; } else { $pw = escape_data($_POST['password']); } if (empty($errors)) //both fields are filled -BB { // validate their email and password // //make the query $query = "SELECT userid, password, firstname, lastname, points FROM account WHERE userid = '$em' AND password='$pw'"; $result = @mysql_query($query); //run the query $row = mysql_fetch_array ($result, MYSQL_NUM); //return a record if ($row) { //found a match if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\')) { $url = substr($url,0,-1); //chop off slash } $url .= './loggedin.php'; if (!headers_sent()) { setcookie ('userid',$row[0]); setcookie ('firstname',$row[2]); header("Location: $url"); exit(); //quit script } } } //end of empty errors check -BBclosed } $pagetitle = "Share a lead"; include ('./header.php'); // I even removed this but it still sent headers // // I took out all formating below to see if that would help...still sent headers but it seems like it has to be coming from the form // ?> <form action="signin.php" method="post"> <p><b>Email:<input type="text" name="userid" size="40" maxlength="40" /> </p> <p><b>Password:<input type="text" name="password" size="10" maxlength="10"/> </p> <p><input type="submit" name="submit" value="SignIn" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form>
  5. I'm working on passing cookies from my signin.php to my home page - I am using the exact logic as in the login.php script except for the redirection is named differently. I have 'echo'ed the header_sent function to see where this is happening and it happens before my "if...submitted" statement. There is no html before that or in the php, and all the error messages are saved to print later...the form itself is html but I've written it exactly like the book - there still seems to be a header file from the first display of the form prior to entering any information in the fields...any way to close the header file after displaying the form the first time? in the book it says something about "no empty lines outside of php tags" huh?
×
×
  • Create New...