TheJoey Posted August 27, 2009 Share Posted August 27, 2009 <?php error_reporting(E_ALL); ini_set('display_errors', '1'); if (isset($_POST['email'] , $_POST['fname'] , $_POST['lname'] , $_POST['age'] , $_POST['address'] , $_POST['city'])) { // some form of email validation $email = ($_POST['email']); $fname = ($_POST['fname']); $lname = ($_POST['lname']); $age = ($_POST['age']); $address = ($_POST['address']); $city = ($_POST['city']); $user_info = $email . "||" . $fname . "||" . $lname . "||" . $age . "||" . $address . "||" . $city; // write-to file $filename = 'text.txt'; // attempt to open the file if ($handle = fopen($filename, 'a')) { // attempt to write to the file if (!fwrite ($handle, $user_info)) { echo 'Cannot write to file'; } else { echo 'Written to file'; } } fclose($handle); } ?> i take out the else but then it doesnt do as i want. kinda stuck Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/ Share on other sites More sharing options...
Rommeo Posted August 27, 2009 Share Posted August 27, 2009 What does it says when you run this code ? Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907241 Share on other sites More sharing options...
TheJoey Posted August 27, 2009 Author Share Posted August 27, 2009 Parse error: syntax error, unexpected T_ELSE in C:\xampplite\htdocs\part2\text1.php on line 37 sorry forgot to post it Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907244 Share on other sites More sharing options...
MadTechie Posted August 27, 2009 Share Posted August 27, 2009 Couldn't see an error, just tried it here.. no error! Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907250 Share on other sites More sharing options...
TheJoey Posted August 27, 2009 Author Share Posted August 27, 2009 Stupid me, i was using the wrong .php file in my action Thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907255 Share on other sites More sharing options...
MadTechie Posted August 27, 2009 Share Posted August 27, 2009 LOL, I think we have all done that before normally more coffee solves it Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907262 Share on other sites More sharing options...
TheJoey Posted August 27, 2009 Author Share Posted August 27, 2009 Again thanks. Like im new to php but i dont think im stupid yeh ive just woke up Quote Link to comment https://forums.phpfreaks.com/topic/172065-solved-syntax-else-problem/#findComment-907266 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.