Jump to content

[SOLVED] No confirmation page !


sniperscope

Recommended Posts

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');

?>

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
}
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.