sniperscope Posted December 29, 2008 Share Posted December 29, 2008 Hi, I am building a 3 steps entry page, first 2 pages working great but when i click to Next button on page 2 it take me to the Admin panel which i set up on Page 3 and it never insert any record, however if i delete header('location: admin_panel.php'); line on Page 3 (Which is Confirmation page )then Page 3 shows up and insert record after confirmation button clicked. Did i skipped something ? And another question problem is; (again in Step 3 page) The script i wrote below is always give me an error and says "Folder already exist" which is not exist actually. <?php // CREATING A NEW FOLDER WITH STUFF NAME $file_name = $_POST['stuff_name']; if(is_dir($_POST['stuff_name'])){ echo "This file already created."; exit; } else { mkdir("../img/".$_POST['stuff_name']); echo "File created..."; } header('location: admin_panel.php'); ?> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 29, 2008 Share Posted December 29, 2008 Can you post the whole code for page 3? Unless you're using something like ob_start() followed by a different buffer function the header needs to be set after all the code is run, otherwise it will just send the browser to the header('location'); page without executing any script. Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 29, 2008 Share Posted December 29, 2008 Try this. <?php // CREATING A NEW FOLDER WITH STUFF NAME $file_name = $_POST['stuff_name']; if(is_dir($_POST['stuff_name'])){ echo "This file already created."; exit; } else { mkdir("../img/".$_POST['stuff_name']); echo "File created..."; }else{ if(is_dir($_POST['stuff_name'])){ header('location: admin_panel.php'); exit; } } ?> Quote Link to comment Share on other sites More sharing options...
gevans Posted December 29, 2008 Share Posted December 29, 2008 @ redarrow to else statement in one if statement won't work like that... I think you missed out a starting if statement (or the second else shouldn't be there) Quote Link to comment Share on other sites More sharing options...
sniperscope Posted December 29, 2008 Author Share Posted December 29, 2008 Thanks for interesting. Seems i solved my problem, here i want to share the solution. I create new blank page and put all codes which insert data into 6 different tables and i link to that blank page via <form name=\"form1\" action=\"insert_records.php\">, so far i can see the confirmation page and code stops there untill i click the Submit button. By the way, gevans can you explain little more about ob_start() because i am very curious about it now. And Redarrow seems you forgot an else, but no problem anymore. Thanks for every one who read this post and sent a reply for help With my Regards Quote Link to comment 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.