Re: Complicated Php
From: Ginzo (sumpn_at_hotmail.com)
Date: 12/01/04
- Next message: Tommy Gildseth: "Re: License Question"
- Previous message: Ginzo: "Re: dynamic dropdown box"
- In reply to: adam: "Complicated Php"
- Next in thread: Matthias Esken: "Re: Complicated Php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 01 Dec 2004 08:21:34 -0500
The newly set session variables aren't intialized until the current
page is reloaded or a new page is loaded that calls upon them. One
solution is some sort of directed refresh (say a text link). Less
reliable is a META Refresh.
Best solution, when intially setting these values, create a global
counterpart (eg $_SESSION[myvariable] and $myvariable. This can be a
little code intensive for many things; however, it solves the problem
quite neatly.
You also need to bag those globals brother.
On 30 Nov 2004 12:58:32 -0800, adamnichols45@hotmail.com (adam) wrote:
>Hi guys i have this page and it brings over lots of varibles and also
>an image is being uploaded into a folder on the server here.
>
>problems is i get an error on to of the varibles and the image is not
>showing BUT as soon as i refresh the varibles are showing and so is
>the image i cant figure out why i would appreciate any help please
>
>
><?php
>session_start();
>$_SESSION['price'];
>$_SESSION['filename']=$HTTP_POST_FILES['upfile']['name'];
>$test = $HTTP_POST_FILES['upfile']['name'];
>$test2 = $_SESSION['log'];
>$test3= ($test2 .= $test);
>$_SESSION['reg'];
>$_SESSION['mileage'];
>$_SESSION['colour'];
>$_SESSION['email'];
>$_SESSION['pcode'];
>$_SESSION['adtelno'];
>$_SESSION['adtelno2'];
>$_SESSION['adcost']=$_POST['adcost'];
>$_SESSION['make']=$_POST['myselect_1'];
>$_SESSION['model']=$_POST['myselect_2'];
>$_SESSION['photodesc']=$_POST['photodesc'];
>$_SESSION['week']=$_POST['week'];
>
>// This presumes 'config.php' is in the same directory
>// as the page you are protecting - modify the path if your config.php
>file is
>// in a different location:
>include_once("config.php");
>
>// Check user logged in already:
>checkLoggedIn("yes");
>?>
><html>
><head>
> <title>Carpound.Co.Uk</title>
> <link href="index.css" rel="style***" type="text/css">
></head>
>
><body bgcolor="ffffff" marginheight="0" topmargin="0" marginwidth="0"
>leftmargin="0">
><table border="0" cellspacing="0" cellpadding="0" width="100%">
> <tr>
> <td> </td>
> <td width="750">
><!*********************************** centers table below
>************************************>
> <table border="0" cellspacing="0" cellpadding="0" width="750">
> <tr>
> <td><?php include "header.php" ?></td>
> </tr>
> <tr>
> <td width="750" valign="top" bgcolor="EDEDED">
> <table border="0" cellspacing="0" cellpadding="0" width="750">
> <tr>
> <td> </td>
> <td class="blackb">Sell Your Car</td>
> </tr>
> <tr><td> </td>
> <td> </td>
> </tr>
> <tr>
> <td> </td>
> <td align="center">
> <table border="0" cellspacing="0" cellpadding="0"
>width="550">
> <tr>
> <td class="bb">Place an advert:</td>
> </tr>
> <tr>
> <td class="black">
> Below is an example of how your advert will appear on here.
> </td>
> </tr>
> </table>
> </td>
> </tr>
> <tr>
> <td> </td>
> <td><img src="images/trans.gif" alt="" width="1" height="15"
>border="0"></td></tr>
> <tr><td> </td>
> <td align="center">
> <table border="0" class="this3" cellspacing="0"
>cellpadding="0" width="550">
> <form name="myform" enctype="multipart/form-data"
>action="sell4.php" method="POST">
> <Tr>
> <td width="200" class="this4" align="center"
>valign="middle">
> <?php
>
>if( !is_dir($store_dir) )
>{
> echo("Specified directory is not valid... Exiting");
> @unlink($HTTP_POST_FILES['upfile']['tmp_name']);
> exit();
>}
> if( copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$test3) )
>{
> echo("");
>}
>else
>{
> echo("Upload of ".$HTTP_POST_FILES['upfile']['name']." to
>".$store_dir." failed!!!!<BR>");
>}
>@unlink($HTTP_POST_FILES['upfile']['tmp_name']);
>?><img src="uploads/<?php echo $filename; ?>" width="180"
>height="150">
><input type="hidden" name="imageinput" value="<?php
>echo($_SESSION["login"]); echo $filename; ?>">
> </td>
> <td>
> <table border="0" cellspacing="0" cellpadding="0"
>width="350">
> <tr>
> <td width="10"> </td>
> <td class="bullet" colspan="2"></td>
> <td> </td>
> </tr>
> <tr>
> <td width="10"> </td>
> <td class="bullet" bgcolor="E7E7E7" width="340"
>height="100" colspan="2"><?php echo $photodesc; ?></td>
> <td> </td>
> </tr>
> <tr>
> <td width="10"> </td>
> <td class="bullet"> </td>
> <td> </td>
> </tr>
> <tr>
> <td width="10"> </td>
> <td width="70" class="bullet">Tel.</td>
> <td class="black" width="270"><?php echo $adtelno;
>?></td>
> </tr>
> <tr>
> <td width="10"> </td>
> <td width="70" class="bullet">Email.</td>
> <td class="black" width="270"><?php echo $email; ?></td>
> </tr>
> <tr>
> <td width="10"> </td>
> <td width="70" class="bullet">Price.</td>
> <td class="black" width="270"><?php echo $price; ?></td>
>
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </td>
> </tr>
> <tr>
> <td> </td>
> <td><img src="images/trans.gif" alt="" width="1" height="50"
>border="0"></td></tr>
> <tr><td> </td>
> <td>
>
> </td></tr>
> <tr>
> <td bgcolor="99CC00" height="40"> </td>
> <td bgcolor="99CC00" height="40" align="center">
> <INPUT TYPE="image" src="images/next2.gif" name="submit">
> </td></tr>
> </form>
> </table>
> </td>
> </tr>
> </table>
> </td>
> <td> </td>
> </tr>
></table>
>
>
></body>
></html>
Ciao,
Ginzo
---------------------------------
War is god's way of teaching
Americans geography
-- Ambrose Bierce
---------------------------------
- Next message: Tommy Gildseth: "Re: License Question"
- Previous message: Ginzo: "Re: dynamic dropdown box"
- In reply to: adam: "Complicated Php"
- Next in thread: Matthias Esken: "Re: Complicated Php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]