Pavlos1316 Posted June 1, 2008 Share Posted June 1, 2008 Hi.. I have this code for check boxes starting... $home= 'unchecked'; ..... if (isset($_POST['Submit'])) { if (isset($_POST['home'])) { $home = $_POST['home']; if ($home = = 'home') { (line61)$home = 'checked'; } } } when I submit I get: syntax error, unexpected '=' in line 61 any advice? Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/ Share on other sites More sharing options...
BlueSkyIS Posted June 1, 2008 Share Posted June 1, 2008 == instead of = = Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554945 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 NO I doesn't say anything else and == doesn't work either. It returns the same msg Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554946 Share on other sites More sharing options...
sasa Posted June 1, 2008 Share Posted June 1, 2008 == instead of = = in line 60 Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554952 Share on other sites More sharing options...
BlueSkyIS Posted June 1, 2008 Share Posted June 1, 2008 yes. <?php $home= 'unchecked'; if (isset($_POST['Submit'])) { if (isset($_POST['home'])) { $home = $_POST['home']; if ($home == 'home') { $home = 'checked'; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554955 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 Sorry.. now i got it... my brain isn't working correct after 5 hours of working on my site. Thank you... Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554959 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 Oh... now I have no errors but I get nothing in my database!!!!! I know my connection string works, so...? Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554962 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 so...it would help if you posted relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554965 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 my connection string.... blabla.php $dbhost = "localhost"; $dbname = "db"; $dbuser = "user"; $dbpass = "pass"; //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error());mysql_select_db($dbname) or die(mysql_error()); my form <body> <form id="form1" name="form1" method="post" action="blabla.php"> <span class="style3"> <input type="checkbox" name="home" id="home" /> <?PHP print $home; ?> -</span> </body> </form> Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554971 Share on other sites More sharing options...
BlueSkyIS Posted June 1, 2008 Share Posted June 1, 2008 i don't see where you create or execute any SQL. ??? Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554972 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 this is for my submit button <input type="submit" name="submit" onclick="this.form.post" id="submit" value="Submit" /> Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554979 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 don't say anything.... I know... I'm loosing my mind.... I will think 5 times before i post anything today!! Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-554983 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 thanks for that... Its working fine!!!! now i really need something.. lets say i have 4 check boxes. I need the user to be able to submit ONLY and NOT LESS than 2 You now how to help me? Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-555006 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 Your first post shows that you understand the concept of conditions... Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-555009 Share on other sites More sharing options...
Pavlos1316 Posted June 1, 2008 Author Share Posted June 1, 2008 NO NOT REALLY... I am new at this.. If I have an example I can read it and make it work for me... But to create the example... no.. I have help from forums. This forum... I ve learn how to use dreamweaver to desing my site and forms and buttons. it was pretty easy but I don't have the time to learn by my self how to write my own scripts. So any help is welcomed... Quote Link to comment https://forums.phpfreaks.com/topic/108256-syntax-error/#findComment-555016 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.