Bounty Posted June 30, 2010 Share Posted June 30, 2010 Heya...i'm getting this strange result when writing php in dreamweaver. When typing <?php tag below <body> it goes red letters and it displays it as an error..even in basic scripts like <html> <body> <?php echo "Hello World"; ?> </body> </html> This is the picture of it.. And when i try to open my html page all html comments (text behind "//") shows on the page.. Can you tell me what is wrong? Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/ Share on other sites More sharing options...
trq Posted July 1, 2010 Share Posted July 1, 2010 Can you post your actual code? Looks to me like your escaping stuff unnecessarily. Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079437 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 Here...this is the original code it wont work too...:// <html> <body> <?php $url = /'http://www.yourdomain.com/accountok.php\'; // Where to redirect //the user after that form has been processed successfully. Now we will //get the values sent by the form: to get a value you can generally access //it with $_POST[\'valuename\'] where valuename is the string you put into //the value of the the field you are accessing $user = $_POST[\'username\'];//get username from form $pass = $_POST[\'password\'];//get password from form $pass2 = $_POST[\'password2\'];//get password2 from form $name = $_POST[\'name\'];//get name from form $domain = $_POST[\'domain\'];//get domain from form $zip = $_POST[\'zip\'];//get zip from form $city = $_POST[\'city\'];//get city from form $email = $_POST[\'email\'];//get email from form $state = $_POST[\'state\'];//get state from form $country = $_POST[\'country\'];//get country from form $address = $_POST[\'address\'];//get address from form $phone = $_POST[\'phone\'];//get phone from form //now that we have picked all the values we need from the form we can //start checking them one at a time //PASSWORD VERIFICATION if (($pass)!=($pass2)) //if the values stored in the 2 variables are //different we redirect the users to a previously created error page { header("Location: error-pwverify.php"); //the user will be sent to this page Die(); } //EMAIL VERIFICATION function CheckMail($email) // this function checks if the email format is ok, //if the chars are allowed, if there are enough chars in the TLD learn more //about eregi function here: http://www.php.net/manual/en/function.eregi.php { if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$",$email)) { return true; } else { return false; } } if ((empty($email)) || (!CheckMail($email))) //here we check if the email is //empty and if the previous function controls are passed, if there are //errors the user is sent to a previously prepared custom error page { header("Location: error-email.php"); //the user will be sent to this page Die(); } //ZIP CODE VERIFICATION function CheckZip($zip) { if (eregi("[0-9]", $zip)) //here we check if the ZIP code contains only numbers { return true; } else { return false; } } if ((empty($zip)) || (!CheckZip($zip)) || (strlen($zip)!=5)) //if the ZIP code is empty, the CheckZip function fails or the code length is //different from 5 chars the user is sent to a previously prepared custom error page { header("Location: error-zip.php"); //the user will be sent to this page Die(); } //NAME VERIFICATION //the name and the following fields don\'t allow us to make strict //verifications by the way the user has to have a name so if the name //is empty the user is sent to a previously prepared custom error page if (empty($name)) { header("Location: error-name.php"); //the user will be sent to this page Die(); } //CITY VERIFICATION //exactly the same as the name verification if (empty($city)) { header("Location: error-city.php"); //the user will be sent to this page Die(); } //STATE/PROVINCE VERIFICATION //exactly the same as the name verification if (empty($state)) { header("Location: error-state.php"); //the user will be sent to this page Die(); } //COUNTRY VERIFICATION //exactly the same as the name verification if (empty($country)) { header("Location: error-country.php"); //the user will be sent to this page Die(); } //ADDRESS VERIFICATION //exactly the same as the name verification if (empty($address)) { header("Location: error-address.php"); //the user will be sent to this page Die(); } //USER AND PASSWORD LENGTH CHECK $min_lenngth = 6; //this value is the minimal length that we desire our passwords //to be if the username or the password is shorter than 6 chars the user is sent //to a previously prepared custom error page if(strlen($user) < $min_lenngth || strlen($pass) < $min_lenngth) { header("Location: error-pwshort.php"); //the user will be sent to this page Die(); } //NOTE: insert here the code between //****************// and //****************// //in the following part of the tutorial if you want to add these values to your //database //NOTE:don\'t use the following code line (erase it) if you inserted here the code //to add the values to the database //if all our checks are passed we go to the url assigned at the top to the variable url echo <META HTTP-EQUIV=Refresh CONTENT="0; URL=.$url.">; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079438 Share on other sites More sharing options...
trq Posted July 1, 2010 Share Posted July 1, 2010 On this line.... $url = /'http://www.yourdomain.com/accountok.php\'; // Where to redirect The very first / does not belong there. Your also escaping the closing ' Then, all these lines.... $user = $_POST[\'username\'];//get username from form Why are you escaping the single quotes? Don't. Generally, if your editor starts highlighting things incorrectly it means your code is incorrect. As is the case here. Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079456 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 Its solved for now...if i have any more difficulties with this ill post them here..thanks for quick answer ) Another question... Can you tell me how can i make a page that creates pages...like on youtube.com,every clip has its own page,right? and only 1 page that makes them (the upload one)...or can you at least point me in right direction...a tutorial or anything... Thanks =))) Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079481 Share on other sites More sharing options...
trq Posted July 1, 2010 Share Posted July 1, 2010 This is pretty much the basics of what php is used for. Creating dynamic pages from data stored within a database. You don't actually create a physical page for each clip. There's some sort of example I wrote here : http://www.phpfreaks.com/forums/index.php/topic,227131.msg1048650.html#msg1048650 Though the net would have literally thousands of examples of this if your searched. Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079496 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 I would search if i knew what i was looking for or how to name it xDD Thanks on answers i will try all of this today so if i get any errors ill post here Umm i just remembered one...where can i find virtual ftp server,like offline host so i can test all of this...? Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079630 Share on other sites More sharing options...
trq Posted July 1, 2010 Share Posted July 1, 2010 where can i find virtual ftp server,like offline host so i can test all of this...? You need a http server and your much better off installing one locally. Google for Xampp to get up and running easily. Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079632 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 Ok i installed the software and it works charming...only problem is in my script line 166 witch says: echo <META HTTP-EQUIV=Refresh CONTENT="0; URL=.$url."> Error: syntax error, unexpected '<' in C:\xampp\htdocs\livereg.php on line 166 Whats the problem? Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079679 Share on other sites More sharing options...
kenrbnsn Posted July 1, 2010 Share Posted July 1, 2010 No quotes to start/end your string: <?php echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=' . $url . '">'; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079685 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 One more.. $connection = mysql_connect('host', 'user', 'password'); I'm using this Xampp virtual server program...ive never registered or anything...what is my db password and how can i change it??? Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079767 Share on other sites More sharing options...
wildteen88 Posted July 1, 2010 Share Posted July 1, 2010 I believe with XAMPP the username will be root with no password. So leave the password field blank. Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079822 Share on other sites More sharing options...
Bounty Posted July 1, 2010 Author Share Posted July 1, 2010 Ok i managed to change the password and now it connects ok...but it wont select sql database,this is the code..idk what is wrong :/// $connection = mysql_connect("localhost", "root", "*password*"); mysql_select_db("users") or die( "Unable to select database"); Database is called "users"...:/ Thanks u helped me alot Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1079968 Share on other sites More sharing options...
Bounty Posted July 3, 2010 Author Share Posted July 3, 2010 Any idea why this wont work?? Quote Link to comment https://forums.phpfreaks.com/topic/206341-php-dreamweaver-error/#findComment-1080521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.