Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Hi all, just wanna get this working, i know there will be a real easy way for this to be done so please help me out.

    i got a template and db set with a pageid etc. so when i got .....index.php?pageid=1 that goes to the database and pulls out an include that then loads the right page into the template. okay.
    got that done, its sorted.

    i wanna put a form on there so u can basically put in your own id, and then that will goto the correct page, based on the id, so i want to really now, how to get the data from the form into the address bar. i attempted but i failed ! i know its a post variable thing, can anyone give me a code for this or something ? cheers.

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Assuming you know how to use HTML forms, use this PHP:
    PHP Code:
    $id intval($_POST['id']);
    mysql_query("UPDATE whatever SET something = newvalue WHERE id = $id"); 
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    well i dont know exactly what to do with that, but i know html very well.

    i got this code, i dunno if anyone can insert the right stuff, but i got it wrong somehow.

    As you can imagine, i cut the irelevant stuff out.

    Code:
    <td width="545"><form name="pageid_sel" method="post" action="index3.php?pageid="
    <input name="pageid" type="text" size="5" maxlength="5">
    <input type="submit" name="submit" value="Submit">
                                        </form></td>
    any help is appreciated, cheers.

  5. #4
    Senior Member Brak's Avatar
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    3,413
    Member #
    1217
    Liked
    2 times
    Code:
    <form name="pageid_sel" method="GET" action="index3.php">
    <input name="pageid" type="text" size="5" maxlength="5">
    <input type="submit" name="submit" value="Submit">
    </form>
    Method GET will put all form data in adress bar
    Kyle Neath: Rockstar extraordinare
    The blog | The poetry site | The Spore site

  6. #5
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    well thanks very much, some fellow web designer told me it was post, what a sad guy .

    ----EDIT-----
    i fixed it, i mean it goes.
    u wanna see the simple page ?
    http://www.unleashed.co.nz/index3ls.php or the front page
    http://www.unleashed.co.nz/index3.php

  7. #6
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    Kewlness. Why do you want someone to input id numbers? Is is just for testing, or something that will develop into a functionality tool for users accessing your site?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  8. #7
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    yeah, just testing. i gotta ask another question bout that.

    Can i put a little code that will either carry the users name from page to page, till they click a clear button or something, or a cookie to carry the variable around. I hope that adding a personal touch to the site like that it will be good, but is that tacki ? should i cookie or what ?

    The next question would be, show the input name if the value is null, or hide the form , and the input box if the nameid string contains something. then i spose display a thing to fill that form gap, that would say, welcome back {nameid}

    is that a mouthful or what ?

    ---------EDIT------------
    Carrying var info via the http_vars is real simple, but its fairly cheaply done ay ?

  9. #8
    Senior Member Brak's Avatar
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    3,413
    Member #
    1217
    Liked
    2 times
    cookies/sessions are probably your best bet there... here's a quick snippet of some stuff I used in one of my pages:

    Code:
    $cookie = $HTTP_COOKIE_VARS['RFSWEB'];
    $user = $cookie['username'];
    $id = $cookie['id'];
    if (mysql_query("SELECT username, id FROM users WHERE username = '$user' AND id = '$id'")){
    	$username = $user;
    }else{$user = "";}
    That checks to see if they have the cookie I sent to them via the login script here:
    Code:
    setcookie("RFSWEB[username]", $username, time()+ 31536000);
    		setcookie("RFSWEB[id]", $rand, time()+ 31536000);
    Then to do a welcome back...
    Code:
    if($username){
    echo "Welcome back $username";
    }else{
    echo "<a href='login.php'>login</a>";
    }
    Hope that helps...
    Kyle Neath: Rockstar extraordinare
    The blog | The poetry site | The Spore site


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:02 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com