Results 1 to 3 of 3

Thread: Lost Variable

Threaded View

  1. #1
    Join Date
    Oct 2013

    Lost Variable

    I need som help - I really cant see where I do the mistake!

    I have a page that loads its content using variable given in an URL like:

    PHP Code:
    The webpage is a page where you can change the name, description etc. Click "Update" and the information is saved (this part works fine)

    When clicking "Update" the user should be taken back to the old URL where they came from like this:

    PHP Code:
    Im using the below code to send the user back to the old URL:

    PHP Code:
    header("Location: galleries.php?folder=".$folder."&id=".$id.""); 
    But the folder variable is not saved/remembered/transfered to the new URL. When I use the above the URL looks like:

    PHP Code:
    Means that folder variable is lost but the id is used correct. Why does the folder variable not work?

    The copleate code of the site looks like:
    PHP Code:
    include "../config.php";

    $query mysql_query("select name, type, folder, description , displaydate from galleries where id = '".$_GET["id"]."' ");
    $row mysql_fetch_row($query);
    $name $row[0];
    $type $row[1];
    $folder $row[2];
    $description $row[3];
    $displaydate $row[4];

    <form method="POST" action="<?=$_SERVER["PHP_SELF"]?>" name="myform" id="myform">
    <center><table width="<?=$setting["tablewidth"]?>" class="admintable" cellpadding="<?=$setting["cellpadding"]?>">
        <td class="adminheader" colspan="2">&nbsp;<b>Edit Gallery:</b></td>

                <td class="admincell">&nbsp;Name:</td>
                <td class="admincell">
    <input type="text" name="name" value="<?=$name?>" size="40"></td>
                <td class="admincell">&nbsp;Category:</td><td class="admincell">


    <tr valign="top">
    <td class="admincell">&nbsp;Display Date:</td>
    <td class="admincell" align="">
        <input style="border-style:hidden" type="text" value="<?=$displaydate?>" id="from" id="<?php echo $_REQUEST["from"]; ?>" name="displaydate" size="40">
        (yyyymmdd - Like <?=date('Ymd');?> or <?=date('Y-m-d');?>)</td>
    <tr valign="top">
    <td class="admincell">&nbsp;Description:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td class="admincell">

    <textarea id="Enter you description of the photo set here" name="description"><?=$description?></textarea></td>
    <!-- http://ckeditor.com/ -->          
                    CKEDITOR.replace( 'description' );
    <td class="admincell" colspan="2"><input type="hidden" name="id" value="<?=$_GET["id"]?>"><center>
    <input type="submit" name="submit" value="Update"></center></td>



    include "footer.php";

    mysql_query("update galleries set name = '".$_POST["name"]."', description = '".$_POST["description"]."' , displaydate = '" $_POST["displaydate"] . "' where id = '".$_POST["id"]."' ");

    header("Location: galleries.php?folder=".$folder."&id=".$id."");
    //header("Location: galleries.php?folder=".$_GET['folder']);
    //header("Location: galleries.php");
    Last edited by NogDog; 04-29-2014 at 10:07 AM. Reason: added missing closing [/php] tag

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center