[PHP/MySQL] simple questions

macromp

the retarded one
Joined
29 Jul 2002
Messages
426
i'm completely new to php, but have to use it for a uni project. i've got a few questions about the site i'm making for my dad's business using dreamweaver. the site is www.domesticelectrical.net, and as you can see when it first loads up there's nothing in the content frame, i want the "information" page to load up there at the very start but dont know how to do that.

and i'm also trying to get a login script working, i've been using what i think is a pretty good tutorial here but i'm having a problem with the initial loading of the page. if you click the login button you will see what i mean.

Warning: session_start(): Cannot send session cookie - headers already sent... etc

i read another post on the forum with someone having the same kind of problem, but couldnt figure out what i needed to change (dont like programming, find it hard to grasp) i did add thefollowing bit of php as suggested in an earlier thread but it didnt seem to work.

Code:
<?php
ob_start( 'ob_gzhandler' );
?>
i was thinking that it's trying to check the login before the session was started...but i'm not sure.
any help on the matter would be great. i'm using code from the tutorial website, but if you need to see any other code jsut ask what you need and i will post it here.
 
make sure that code is right at the top of ANY other code, not just the middle frame code.

for the default page in the middle set the src property to the information page <iframe src ="whatever.php/html" ..... etc
 
ok that was stupidly easy, the only thing above it was the link to the css file. thank you for that.

one more thing, the "username" and "password" arent fully 'using' the css file. the text color has changed but the size hasnt. can that be changed somehow?
 
add
Code:
td {
font-family: Verdana;
    font-size: 12px;
}
to the css file
 
thank you again. no doubt i'll be back later when something else doesnt work.
 
well that didnt take long did it. i have a problem with the database now, i've been into phpmyadmin and entered a username and password into the table, but when i enter those same values into the login boxes and click login, it says that i'm using the wrong password...which i'm not. i'm not getting any errors anywhere, so i dont know where to start trying to debug it...
 
Do you get the message 'Incorrect password, please try again.'? if so then you cannot enter the password and username dirctly into mysql because the script you are using is looking for an encrypted password, and as such it won't work if you just type it in plain text into the database, you have to use their register.php page (or modified obviously).

if you got a different error (somthing like Access denied for user: 'userName' (Using password: passWord) ) then check you enrered the correct mysql username and password in db_connect.php page
 
yeah it's the 'Incorrect password, please try again.' so i've got to modify it to stop looking for an encrypted password...oh dear. thanks

edit: figured it out, just removed the line with the "md5" bit, whatever that means.
 
Last edited:
md5 is the encryption function and algorithm
 
hi, i'm back again, i've got all my file uploads and login working fine, there's just one simple thing i'd like it to do. i want a text box on a page and when someone enters text in and submits it it's displayed on a different page, kind of like a news post...but uber simple. the php version of response.write (asp)...i have no idea what it is but would like to know. anyone?

thanks for all your help khayman btw, much appreciated.
 
Last edited:
ok, you need a form on the page, normal html form with a text box and submit
Code:
[B] <form action="whatname.php" method="post">
      <input type="text" name="Fname"><br>
      <input type="submit" value="submit">
</form>[/B]

the action attribute tells it where its going
then on that page you could have something like
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
</head>

<body>
<?
      $firstname= $_POST["Fname"];
      echo "Welcome $firstname to our web page";
?>
</body>
</html>
I hope thats kind of what you were looking for
 
yeah that's the kind of thing i'm wanting, i've got a page with "edit post" and "view post", "edit post" contains the form with the input that you gave me, and "view post" shows what is posted, after clicking the submit button it takes me straight to the "show schedule page", then if i go back to the page with "view post" there is nothing there, i need to save what is posted onto that "view post" page, so next time i come to that page whatever i posted last will be there. if you understand that.
 
Correct me if I am wrong, but there is a note of caution here (with POST variables)maybe? Because I remember employing exactly the same technique and finding some folks advising against it (maybe on security grounds? or Maybe a compatibility potential issue?) Just thought I'd chip in, hope useful...
 
security isnt an issue, it's just being used today in my presentation until i can find a proper replacement. i just need a simple way of posting a note, and being able to view it. i've got everything i need for the project but i decided to try and add this at the last minute, and perhaps i shouldn't have. presentation in 1 hour :p
 
Khayman said:
add
Code:
td {
font-family: Verdana;
    font-size: 12px;
}
to the css file

Always include a generic font, you should always have serif or sans-serif in a font declaration:

Code:
td {
font-family: Verdana, sans-serif;
    font-size: 12px;
}

As far as security, you have the variable in double quotes, which is what you want. The difference between POST and GET are the way the variables are sent. Read here -> http://www.faqs.org/docs/gazette/superglobals.html
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back