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
https://forums.phpfreaks.com/topic/138711-solved-no-confirmation-page/
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.

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.