Jump to content

stuckwithcode

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Posts posted by stuckwithcode

  1. my page is called test.php, when i type in the address http://localhost/test.php?test=true why does the code not echo the word hello and then end the session.

     

    <?php 
    session_start(); 
    
    if ($_GET['test']) 
    {
    $_SESSION['testsession'] = true;		
    header('Location: test.php');
    }
    
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    
    <body>
    <?php
    if (isset($_SESSION['testsession']))
    {
    echo "Hello";
    unset($_SESSION['testsession']);
    }		
    ?>
    </body>
    </html>
    

     

    thanks if not possible other ideas welcome

  2. I am trying to echosome text, so I convert the spaces to &nbsp  and its works, apart from the last one is show as &nbsp not as a space

     

    			$test =  "car     a";
    		$test = str_replace(" ", "&nbsp", $test);
    		echo $test;
    

     

    but i get "car    &nbspa", how can I get all of the spaces or get php to echo multiple spaces

     

    Thanks

  3. I wasn't sure you could do that.

     

    With my problem the code does work in a php file on its own but I have a lot of html in my page and when I try to echo this code at the top of the page the line breaks are gone, but not in mozilla etc.

  4. Hello,

     

    I cant seem to get my newly updated php sessions to display there new values until I refresh the page.  I use onunload to run a page that deletes the sessions but when I go back to my page the old sessions are there untill I refresh the page.

     

    Any help?

  5. Hello,

     

    If a user uploads a file and the form doesn't process properly and there is an error is there a way for me to the save the file upload information so the user does not have to re-enter it.

     

    can this be done in js or php?

     

    Thanks

  6. In one file I have the following php code along with a load of html stuff:

     

    <?php 
    echo "<img src='images.php'>";
    ?>
    

     

    In the seperate images.php file I have this code, which produces a black square.

     

    <?php 
    $W = 100;
    $H = 100;
    $Img = imagecreatetruecolor($W, $H);
    header('Content-type: image/jpeg');
    imagejpeg($Img);
    ?>
    

     

    How can I get the black box to output in the same page as all of my html, instead it displays in its own new page.

     

    p.s the images.php file has more to it than that , I just cant get this basic thing to work at the moment.

     

    Can anyone help me? Thanks

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.