Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
strange php phenomena
Old 04-28-2005, 01:27 PM strange php phenomena
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Hi.. Can anybody tell me why my page doesnt fully appear until the refresh button is pressed. if you go to www.farena.co.uk/ap.php and enter a number between 1 and 5000 you will see what i mean. half the page will display, but the rest wont appear until the refresh button is pressed.

PHP Code:
<?php
[COLOR=Red]/*this code is the page that displays, the red parts are where i link to another php page (the page that doesnt display) which is shown below*/ [/COLORpage too but does
session_start
();
?>
<?php 
echo "
<html>
<head>
</head>
<body>
  your aperture width is"
;
  foreach (
$_POST as $field => $apwidth)
   {
  echo 
$apwidth ";
}

  
$_SESSION[ap] = "$apwidth";
?>        mm
<?php

$overlap 
30;
$doorsize2 = (($apwidth +  $overlap)      / 2);
$doorsize3 = (($apwidth + ($overlap 2)) / 3);
$doorsize4 = (($apwidth + ($overlap 3)) / 4);
$doorsize5 = (($apwidth + ($overlap 4)) / 5);

if (
$apwidth <= '2000')
   {
    
$numdoor='2';
   echo 
"<br>you need $numdoor doors $doorsize2 mm wide each";
   [
COLOR=Red]include('glasstype.php');[/COLOR]
   
$_SESSION[doorsize] = "$doorsize2";
   }

elseif (
$apwidth <= '3000' and $apwidth >= '2001')
   {
    
$numdoor='3';
   echo 
"<br>you need $numdoor doors $doorsize3 mm wide each";
   [
COLOR=Red]include('glasstype.php');[/COLOR]
   
$_SESSION[doorsize] = "$doorsize3";
   }

elseif (
$apwidth <= '4000' and $apwidth >= '3001')
   {
    
$numdoor='4';
   echo 
"<br>you need $numdoor doors $doorsize4 mm wide each";
  [
COLOR=Red] include('glasstype.php');[/COLOR]
   
$_SESSION[doorsize] = "$doorsize4";
   }

elseif (
$apwidth <= '5000' and $apwidth >= '4001')
   {
    
$numdoor='5';
   echo 
"<br>you need $numdoor doors $doorsize5 mm wide each";
   [
COLOR=Red]include('glasstype.php');[/COLOR]
   
$_SESSION[doorsize] = "$doorsize5";
   }

else 
   {
   echo 
"<br> please call *******for assistance";
   }

?>
<?php
   
{
   echo 
"<a href=\"glasstype.php\"></a>";;
   }
$_SESSION[numdoor] = "$numdoor"

?>

</body>
</html>

the part which doesnt display:
PHP Code:
<?php
session_start
();
?>
<html>
<head>
</head>
<body>

<?php

{
echo 
"<br><br><br>now choose a glass type for each door:";
}


if (
$_SESSION[numdoor] == '2')
{
include(
'2door.php');
}



elseif (
$_SESSION[numdoor] == '3')
{
include(
'3door.php');
}


elseif (
$_SESSION[numdoor] == '4')
{
include(
'4door.php');
}


elseif (
$_SESSION[numdoor] == '5')
{
include(
'5door.php');
}

else
{
echo
$_SESSION[seekassist]";
}


?>
</body>
</html>

Thanks everybody

Last edited by hiptobesquare; 04-28-2005 at 01:34 PM..
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-28-2005, 01:47 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Change this section:
PHP Code:
<?php 
[COLOR=Red]/*this code is the page that displays, the red parts are where i link to another php page (the page that doesnt display) which is shown below*/ [/COLORpage too but does 
session_start
(); 
?> 
<?php echo 
<html> 
<head> 
</head> 
<body> 
  your aperture width is"

  foreach (
$_POST as $field => $apwidth
   { 
  echo 
$apwidth "


   
$_SESSION[ap] = "$apwidth"
?>        mm 
<?php
to this:
PHP Code:
<?php

session_start
(); 

echo 

<html> 
<head> 
</head> 
<body> 
  your aperture width is"

  foreach (
$_POST as $field => $apwidth
   { 
  echo 
$apwidth "


   
$_SESSION[ap] = "$apwidth"
echo 
'mm';
i took the <?php ?> out, i don't understand why you had so many, there is no need, PHP might be getting confused and just only decoding the first part of the PHP brackets, try it.

I'm probably wrong.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-29-2005, 07:57 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Ha nice work.. havnt tried it yet but will this afternoon and let you know. Thanks
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 04-29-2005, 07:59 AM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
it doesnt make any difference. the code now looks like this but still wont display until the refresh button is clicked. total mystery to me but im no php jedi:
PHP Code:
<?php
session_start
();

 echo 
"
<html>
<head>
</head>
<body>
  your aperture width is"
;
  foreach (
$_POST as $field => $apwidth)
   {
  echo 
$apwidth ";
}

  
$_SESSION[ap] = "$apwidth";
echo
"mm";


$overlap 30;
$doorsize2 = (($apwidth +  $overlap)      / 2);
$doorsize3 = (($apwidth + ($overlap 2)) / 3);
$doorsize4 = (($apwidth + ($overlap 3)) / 4);
$doorsize5 = (($apwidth + ($overlap 4)) / 5);

if (
$apwidth <= '2000')
   {
    
$numdoor='2';
   echo 
"<br>you need $numdoor doors $doorsize2 mm wide each";
   include(
'glasstype.php');
   
$_SESSION[doorsize] = "$doorsize2";
   }

elseif (
$apwidth <= '3000' and $apwidth >= '2001')
   {
    
$numdoor='3';
   echo 
"<br>you need $numdoor doors $doorsize3 mm wide each";
   include(
'glasstype.php');
   
$_SESSION[doorsize] = "$doorsize3";
   }

elseif (
$apwidth <= '4000' and $apwidth >= '3001')
   {
    
$numdoor='4';
   echo 
"<br>you need $numdoor doors $doorsize4 mm wide each";
   include(
'glasstype.php');
   
$_SESSION[doorsize] = "$doorsize4";
   }

elseif (
$apwidth <= '5000' and $apwidth >= '4001')
   {
    
$numdoor='5';
   echo 
"<br>you need $numdoor doors $doorsize5 mm wide each";
   include(
'glasstype.php');
   
$_SESSION[doorsize] = "$doorsize5";
   }

else 
   {
   echo 
"<br> please call 01******* for assistance";
   }

$_SESSION[numdoor] = "$numdoor"
?>

</body>
</html>
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 04-29-2005, 08:56 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Hmm, seems to work fine for me!

I was stabbing in the dark with the php tags there. The only possible thing i think it could be would be the include(); statement, cause it's displaying everything before the if statements right? Try instead to include the file at the beginning of the file, and change the contents of glasstype.php into a function, and make sure you echo the contents.

Every time i've had problems with files being included, that seems to work.

Anyone else got any ideas?
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-29-2005, 12:55 PM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Il have a go at figuring out what you mean. only started php on monday so il have to find out what a function is. thanks for helping i appreciate it. away for the wkend so i wont be able to test it til monday but il keep you posted.
ta
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 05-04-2005, 04:13 PM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Ok i changed the included document into a function and stuck them at the top of the page. still i get the same problem. I dont know what i did to cause this to happen but now every time you visit the page i get the $_SESSION[seekassist] pop up first time. Once i refresh, the $_SESSION[seekassist] disappears and i get the glass options as id expect. sorry if these words are non-sensickle but ive been contemplating php all day.... brain slur. if i havnt explained it well enough here's how i changed the code see for yourself:
PHP Code:
<?php
session_start
();

 echo 
"
<html>
<head>
</head>
<body>
  your aperture is"
;
 
   {
  echo 
$_POST[apwidth] mm wide x $_POST[apheight] mm high";
$_SESSION[apwidth] = "$_POST[apwidth]";
$_SESSION[apheight] = "$_POST[apheight]";
}

  

$_SESSION[seekassist]  ="please call *******";
$overlap 30;
$doorsize2 = (($_SESSION[apwidth] +  $overlap)      / 2);
$doorsize3 = (($_SESSION[apwidth] + ($overlap 2)) / 3);
$doorsize4 = (($_SESSION[apwidth] + ($overlap 3)) / 4);
$doorsize5 = (($_SESSION[apwidth] + ($overlap 4)) / 5);



//this function used to be a seperate program which i included in into this program
 
in exactly the same place as use it as function. Ive tried moving it to various 
  other places in the 
if statement but no joy


function 
glasstype()

  {
echo 
"<br><br><br>now choose a glass type for each door:";
  }

if (
$_SESSION[numdoor] == '2')
  {
include(
'2door.php');
  }

elseif (
$_SESSION[numdoor] == '3')
  {
include(
'3door.php');
  }

elseif (
$_SESSION[numdoor] == '4')
  {
include(
'4door.php');
  }

elseif (
$_SESSION[numdoor] == '5')
  {
include(
'5door.php');
  }

else
  {
echo 
$_SESSION[seekassist]";
  }
return;
}







if (
$_SESSION[apheight] >= '2481')
   {
   echo 
"<br><Br>Sorry, the apperture height you entered is too large to make with a single pain door, call 01582 697753
         and ask about our split panel doors"
;
   }

else if (
$_SESSION[apwidth] <= '2000')
   {
    
$numdoor='2';
echo 
glasstype();
   echo 
"<br>you need $numdoor doors $doorsize2 mm wide and $_SESSION[apheight]mm high each";
   echo 
glasstype();
   
$_SESSION[doorsize] = "$doorsize2";
   }

elseif (
$_SESSION[apwidth] <= '3000' and $_SESSION[apwidth] >= '2001')
   {
    
$numdoor='3';
   echo 
"<br>you need $numdoor doors $doorsize3 mm wide and $_SESSION[apheight]mm high each";
   echo 
glasstype();
   
$_SESSION[doorsize] = "$doorsize3";
   }

elseif (
$_SESSION[apwidth] <= '4000' and $_SESSION[apwidth] >= '3001')
   {
    
$numdoor='4';
   echo 
"<br>you need $numdoor doors $doorsize4 mm wide and $_SESSION[apheight]mm high each";
   echo 
glasstype();
   
$_SESSION[doorsize] = "$doorsize4";
   }

elseif (
$_SESSION[apwidth] <= '5000' and $_SESSION[apwidth] >= '4001')
   {
    
$numdoor='5';
   echo 
"<br>you need $numdoor doors $doorsize5 mm wide and $_SESSION[apheight]mm high each";
   echo 
glasstype();
   
$_SESSION[doorsize] = "$doorsize5";
   }

else 
   {
   echo 
$_SESSION[seekassist];
   }

$_SESSION[numdoor] = "$numdoor"
$_SESSION[door1glass] = "$door1glass";
$_SESSION[door2glass] = "$door2glass";
$_SESSION[door3glass] = "$door3glass";
$_SESSION[door4glass] = "$door4glass";
$_SESSION[door5glass] = "$door5glass";

?>

</body>
</html>

thanks again for looking

Last edited by hiptobesquare; 05-04-2005 at 04:32 PM..
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 05-05-2005, 12:04 PM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Sorted that now. its along the lines of what leavethisplace said pretty much exactly, only i didnt need to change the included glasstype.php into a function. i simply moved the include(glasstype.php) down to the bottom of each if statement so the variables ended up above it. like so:
PHP Code:

if ($_SESSION[apheight] >= '2481')
   {
   echo 
"<br><Br>Sorry, the apperture height you entered is too large to make with a single pain door, call 01582 697753
         and ask about our split panel doors"
;
   }

else if (
$_SESSION[apwidth] <= '2000')
   {
    
$numdoor='2';
   echo 
"<br>you need $numdoor doors $doorsize2 mm wide and $_SESSION[apheight]mm high each";
   
$_SESSION[doorsize] = "$doorsize2";
   
$_SESSION[numdoor] = "$numdoor";
   include(
'glasstype.php');
   } 
isn't php a beautiful language
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 05-05-2005, 12:05 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
hah, when it bloody works!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 05-05-2005, 12:05 PM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Woohoo im now an average talker.
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to strange php phenomena
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32485 seconds with 12 queries