Problem with script structure ???

This is a discussion on "Problem with script structure ???" within the PHP Forum section. This forum, and the thread "Problem with script structure ??? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 9th, 2006, 06:23
Junior Member
Join Date: Jul 2004
Location: Bulgaria
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
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

PHP: Select all

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

PHP: Select all

  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


PHP: Select all

<?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; Jun 9th, 2006 at 13:45.
Reply With Quote

  #2 (permalink)  
Old Jun 9th, 2006, 08:52
Up'n'Coming Member
Join Date: Jan 2006
Location: East Sussex
Age: 26
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
Reply

Tags
problem, script, structure

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 Forum 4 Jan 30th, 2008 23:10
Problem with Action Script shaza2007 Flash & Multimedia Forum 4 Apr 5th, 2007 19:01
Login Script Problem Aaron1988 PHP Forum 5 Nov 20th, 2006 06:15
js/css problem-using the width&height values obtained with js to structure my layout sanchopansa JavaScript Forum 0 Jul 21st, 2006 20:13
Pop-up Window Script Problem James Lake JavaScript Forum 4 Mar 24th, 2006 16:36


All times are GMT. The time now is 20:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43