SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Returning to same userid?

    I'm trying to make an updatescript, and after finishing the update I want to go back to the main page for the same user. I have tryid this, but it doesnt work...
    PHP Code:
    $ClubID=$_POST['ClubID'];
    $Region=$_POST['Region'];
    $Letter=$_POST['Letter'];
    $ClubName=$_POST['ClubName'];

    $dbhost 'myhost';
    $dbuser 'username;
    $dbpass = '
    password';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                    ("Error connecting to mysql: " . mysql_error());

    $dbname = '
    database';
    mysql_select_db($dbname);

    $query="UPDATE clubs SET ClubID='
    $ClubID', Region='$Region', Letter='$Letter', ClubName='$ClubName' WHERE ClubID='$ClubID'";
    mysql_query($query);

    if(!mysql_query($query)){
    print "Error Occurred:". mysql_error() ;
    exit();
    }
    echo "Club Updated...";


    echo '
    <head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <
    meta http-equiv="refresh" content="1;URL=http://www.mypage.com/admin/index.php?clubid=' .$query['ClubID']. '">
    <
    title>Clubadmin Aproved</title>
    </
    head>';
    mysql_close(); 
    In my adress field I get this.
    Can't find my error???

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Take a look at redirecting users with the appropriate headers.

    header("Location: $yoururl");

    Instead of sending a page back to the user that then sends them to their destination.

    php headers make sure NOTHING is written to the browser before doing this header or you will go to "header redirect wont work hell" like most of us have ....

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    http://www.mypage.com/admin/index.php?clubid=' .$ClubID. '
    Also, like Cups said, use PHP to redirect. Meta tags is not necessary unless you were going to show a success message then redirect after x amount of seconds.


Bookmarks

Posting Permissions

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