Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old June 9th, 2006, 02:23 AM   #1
New Member
 

Join Date: Jul 2004
Location: Bulgaria
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 DavidinLondon is on a distinguished road
Problem with script structure ???

I am having a problem getting my script to continue processing after calling (request_once) another script.

There are three scripts involved.
Main one (Homes_add.php) calls the second (a_picts.php) which is a form validating script - which ofcourse calls its form (a_picts_fm.php)

Again - it is clear that the problem is not in returning from a_picts_fm back to a_picts - BUT the problem is returning from a_picts back to the main script ( homes_add script.)

I wonder if there is a fundamental structural problem ?

The main script (homes_add)
calls ( require_once ) the a_picts which processes the form.
The form itself on submisson re-runs the a_picts which when finshed should return to the main script (homes_add) and continue from where it left the off.

To summarise the problem is that the a_pict.php stops at the last line afer executing this :

echo " *** and got here";

IT DOESN'T RETURN TO HOMES_ADD.PRG

- dont know why ???

I have stripped a lot of the code to try and make it clearer.

If anyone can help - I'd much appreciate it as I am a bit stuck !


HERE IS THE MAIN - HOMES_ADD.PHP SCRIPT
IT CALLS THE PICTURE HANDLING SCRIPT

Code:
  <?php 
/*  
*  homes_add.php 

* Called by :  homes_ad_btn.php 

* Call  a_picts.php to get the pictures 

*  processes the  homes_add_fm.php  which is the 
*   FORM for adding a home. 
*/ 
           
if (!isset($_POST['run_mn'])){     

PREPARES DATA AND CALLS THE MAIN FORM NOT PICTURE FORM

else  {   
// BIG else    -  SO MAIN FORM HAS RUN  

   
VALIDATES FORM DATA 

/* 
*  Now we get the pictures. 
*/ 
    
if( $pict ==  "y"){       
       require_once(
"a_picts.php");   //  < --   HERE IS THE CALLING  
       
exit();                              //   < -- I TRIES TAKING THIS OUT           
         
}  // endif  
    
else{ 
       
$N_pix1=$N_pix2=$N_pix3=$N_pix4=$N_pix5="none"
         } 
// end else 

    //  I WANT TO RETURN BACK HERE  
          
$sql =  "UPDATE homes SET 
         pix1 = '$N_pix1',  
         pix2 = '$N_pix2', 
         pix3 = '$N_pix3', 
         pix4  = '$N_pix4', 
         pix5 = '$N_pix5'  
                                              
     WHERE ad_ref =  '$A_ref' "

      
     
mysql_query($sql
    or die(
"could not execute HOMES UPDATE PICTURES query"); 
          
/* 
*  Update  the client table 
*/ 
        
ETC ETC 
       
// end BIG else  
?>
</div>

THIS IS THE SECOND SCRIPT THAT CALLS AND THEN PROCESSES
THE FORM

Code:
  if(isset($_POST['run'])){  // BIG IF  

     
PROCESSES THE PICT_FM.PHP   FORM 

   
echo "got here"
}  
// end BIG IF  

else    { 
    
$message1 "none"
    
$message2 "none"
     require_once  (
"a_picts_fm.php");    //  CALLS THE FORM  
     
exit(); 
    } 
// end else 

echo " *** and got here";      //  THIS WHERE IT STOPS 

?> 
</div>

AND THIS IS THE FORM THAT THE ABOVE REQUIRES


Code:
<?php 
/*  
* picts_fm.php 

* Called by : picts.php 
* IT THEN GOES BACK TO  PICTS.PHP 

* FORM for adding images. 

*/ 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<
html
<
head
<
script type="text/javascript"


<
form name="main_fm" enctype ="multipart/form-data"  action="a_picts.phpmethod="POST"
<
input type 'hidden' name='run'  value="on"
<
input type="hidden" name ="MAX FILE SIZE"  value="500000"
<
input type 'hidden' name='adref' value="<?php echo $A_ref ?>"

<
div style='position:absolute;  left:40px; top:320px' 
<
b>First image:</b><br />  
<
input type="file" size="50" id "u1" name="upLoad1"  onchange="showImg1()"><br /> 
<
input type="text" size="50" id =  "n1" name="fName1" readonly
<
input type="button" value ="Clear"  onclick="document.main_fm.upLoad1.value='';document.main_fm.fName1.value='';document.getElementById('image1')    .src='';document.getElementById('image1').style.display='none'">  
</
div

<
div style='position:absolute; left:500px;  top:262px' 
<
img height='160' width='160' id="image1"  style='display:none' /> 
</
div
 </
form>
</
body>
</
html>

Last edited by Rob; June 9th, 2006 at 09:45 AM..
DavidinLondon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old June 9th, 2006, 04:52 AM   #2
WebForumz Member
 

Join Date: Jan 2006
Location: East Sussex
Age: 28
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Gee Bee is on a distinguished road
Re: Problem with script structure ???

Are the files definately being included and do you definately have display_errors turned on in your php.ini file? If the screen is just white it could be that they are not being included and you have display_errors turned off.
Gee Bee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
problem , script , structure


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with my form script? GeekyBabe PHP 4 January 30th, 2008 07:10 PM
Problem with Action Script shaza2007 Flash and ActionScript 4 April 5th, 2007 03:01 PM
Login Script Problem Aaron1988 PHP 5 November 20th, 2006 02:15 AM
js/css problem-using the width&height values obtained with js to structure my layout sanchopansa JavaScript 0 July 21st, 2006 04:13 PM
Pop-up Window Script Problem James Lake JavaScript 4 March 24th, 2006 12:36 PM


Search Engine Optimization by vBSEO 3.2.0 RC8