Pls help with this form problem

This is a discussion on "Pls help with this form problem" within the PHP Forum section. This forum, and the thread "Pls help with this form problem are both part of the Program Your Website category.



 Subscribe in a reader

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

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Jun 14th, 2006, 11:29
Junior Member
Join Date: Jul 2004
Location: Bulgaria
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Pls help with this form problem

Hi,

I have been trying tho get a solution to this problem for 4 days !

There must be an error but I can not see what it is. This should be pretty simple !

I wrote a script to processes my image-getting form and it is included by my main script which is called [homes_add.php]. After doing the include the main script should just continue processing - right ??
well it doesn't.

I have put in some test displays and you can see them in the code.
The HELLOOOOO gets displayed.

From inside the included script [a_pict.php] a form script [a_pict_fm.php] is run which works fine ( the form just actions the included script again).

The include then finally displays
the two test texts: "got here" and "*** and GOT here"

Then the screen stops.

- GOT HERE !!! on the main script [homes_add.php] does NOT display nor do the other tests !!

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

echo " *** and GOT here";

IT DOESN'T RETURN TO HOMES_ADD.PRG


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

please note the comments where it stops.


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"){   
     echo 
"HELLOOOOO";      //  < --   test  ( this displays ok )  
      
include ("a_picts.php");   //  < --   HERE IS THE CALLING   
     
echo " GOT HERE !!!";  //  < --   test  ( this does NOT display )   
         
}  // endif   
    
else{  
       
$N_pix1=$N_pix2=$N_pix3=$N_pix4=$N_pix5="none";  
         } 
// end else  


echo "Pix1: ".$N_pix1." Pix2: ".$N_pix2." Pix3: ".$N_pix3;   //  < --   test  ( this does NOT display )  
             
$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");  

echo
" DONE HOMES UPDATE";  //  < --   test  ( this does NOT display )            
            
/*  
*  Update the client table  
*/   
        
ETC ETC  
         
// end BIG else  

?>
THIS IS THE FORM 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";     //  it prints this  

  //  THIS WHERE IT STOPS   

?> 
AND THIS IS THE FORM THAT THE ABOVE REQUIRES
(which works fine)



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

         
    var IE = true;   
    if (navigator.appName != "Microsoft Internet Explorer"){IE = false}   

    function showImg1(){   
        var fullName = document.main_fm.upLoad1.value;   
        var fileName = fullName.match(/[^/]+$/);   
        var splitName = fullName.split(".");   
        var fileType = splitName[1];   
        fileType = fileType.toLowerCase();   
        if (fileType == 'gif' || fileType == 'jpg' || fileType == 'jpeg')   
            {  
             if (IE)  
                {   
                document.getElementById('image1').style.display = '';   
        document.getElementById('image1').src = fullName;   
                }   
             document.main_fm.fName1.value = 'Picture file name: '+fileName;   
            }  
        else       {   
              alert('Invalid file type');  
            }  
    }   


</script>  
</head>  
<body>   
<!-- Using a linked stylesheet -->   
<link rel="STYLESHEET" type="text/css" href="yodbod.css">   
<img alt="header (13K)" src="flashtest1.jpg" height="130" width="920" />   

<div style='width:600px; position:absolute; left:40px; top:160px' >   
<b><big>Adding pictures to your advert.</big></b><br>   
<b>Select your picture files from your computer using the browse buttons.</b><br />   
You can have up to five photos for all catagories except Jobs and Careers<br />   
which excepts only one (we couldn't see any reason for more!).<br />   
<br />  
<?php  
if($message1 != "none"){   
  echo 
"$message1<br />$message2";   
// end if  
?>  

</div>   

<form name="main_fm" enctype ="multipart/form-data" action="a_picts.php" method="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' >   
<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>

REALLY HOPE SOMEONE CAN HELP

Last edited by DavidinLondon; Jun 14th, 2006 at 11:32.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 14th, 2006, 16:45
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Pls help with this form problem

How your whole process hangs together seems a little confused and there seems to be bits missing from the snippets of code you have given us but anyway ...

Code: Select all
else    {  
    $message1 = "none";  
    $message2 = "none";   
     require_once ("a_picts_fm.php");    //  CALLS THE FORM   
     exit();  
    } // end else
In this piece of code above you have the line exit();

This will terminate the execution of the php code so you won't go any further.
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

Tags
pls, help, form, problem

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
HTML form problem voodoo465 Web Page Design 4 Sep 27th, 2007 15:13
Problem with results of form Otter PHP Forum 2 Nov 7th, 2006 13:35
Problem with Form Submission Page NewDesigner Web Page Design 4 Oct 6th, 2006 09:36
Problem with form! HELP Please!!! codefantom Classic ASP 2 Aug 30th, 2005 21:06


All times are GMT. The time now is 17:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization 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