+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: POST without submit

  1. #1
    zester's Avatar
    zester is offline x10Hosting Member zester is an unknown quantity at this point
    Join Date
    Jun 2008
    Posts
    23

    Cool POST without submit

    HI all
    I would like to pass variables to the next page without them showing up in the URL like you do with POST in a form. My problem is that the page I that will be sending the variables from dose not have a form on it so I cannot send them with POST command. So is there a way to pass variable with hyper link, or on a button press, that hides the variables like POST.

  2. #2
    TechAsh's Avatar
    TechAsh is offline Retired TechAsh is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    UK
    Posts
    5,853

    re: POST without submit

    You could use hidden fields in a form, and then the visitor will need to click the submit button to move onto the next page.

    Something like:
    Code:
    <FORM method="POST" action="nextpage.php">
    <INPUT type="hidden" name="something" value="<? $avariable; ?>">
    <INPUT type="submit" value="Next ->">
    </FORM>
    Useful Links:
    Terms of Service | Server News | Buy a Domain
    Free Domains: co.cc | Dot.tk -- Free File Storage: Dropbox -- Website Monitoring: Service Uptime


    My Websites:
    Earthtime Games & TechAsh's Blog

  3. #3
    blu3fire's Avatar
    blu3fire is offline x10Hosting Member blu3fire is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    14

    re: POST without submit

    or use JavaScript hyperlink isntead of button

    Code:
    <a href="javascript:document.formnamehere.submit()">CLICK HERE</a>
    Last edited by blu3fire; 07-10-2008 at 07:36 AM.

  4. #4
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    re: POST without submit

    Personally I would just put the data in the user's session and remove it in the next page. That's a lot easier than having to generate it in the html in my opinion. You could just use:

    Page 1:
    PHP Code:
    session_start();
    $_SESSION['name'] = 'value'
    Page 2:
    PHP Code:
    session_start();
    $value $_SESSION['name'];
    unset(
    $_SESSION['name']); 
    This also means that you don't need to generate more html for every link to a page that you want the use the data in.

    By the way, phpasks, what's up with you copying the code/answer people posted before you? You're just restating what's already been said, which is basically spam.
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

  5. #5
    zester's Avatar
    zester is offline x10Hosting Member zester is an unknown quantity at this point
    Join Date
    Jun 2008
    Posts
    23

    re: POST without submit

    I was thinking of using sessions to pass the data but someone told me not to use them. He said it would makes your website unsecure unless you are very good at coding. Is this true?

  6. #6
    konekt's Avatar
    konekt is offline x10 Sophmore konekt is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    100

    re: POST without submit

    Quote Originally Posted by zester View Post
    I was thinking of using sessions to pass the data but someone told me not to use them. He said it would makes your website unsecure unless you are very good at coding. Is this true?
    Not particularly true, at least not in the sense that it does not add a significantly extra shaky security then any other methods that introduce dynamic, slightly public, methods (i.e. POST).


    You could also use cookies.

  7. #7
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    re: POST without submit

    Sessions are more secure than cookies, if that really matters for you. A user can edit/delete cookies, but he can only delete sessions.
    EDIT: I mean, he can delete the cookie that remembers his session, nothing else
    Last edited by marshian; 07-11-2008 at 02:56 AM.
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  8. #8
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    re: POST without submit

    Quote Originally Posted by zester View Post
    I was thinking of using sessions to pass the data but someone told me not to use them. He said it would makes your website unsecure unless you are very good at coding. Is this true?
    The only more secure way to store the data is to have the user login and store it in the database. But even then, unless you want to make people login for every page they access, you need a way to store who that person is.

    Sessions are the most secure way to store temporary data without decreasing your site's usability. The data is stored out of the web root directory(at least it *should* be), which means people can't even view it.
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

  9. #9
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    re: POST without submit

    Even if you were going to use sessions I suggest you create/use some sort of encryption/decryption system so it is secure.

  10. #10
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    re: POST without submit

    Quote Originally Posted by VPmase View Post
    Even if you were going to use sessions I suggest you create/use some sort of encryption/decryption system so it is secure.
    Why would it be required? Session data is stored on the server, under a session name. The user only has the session name, so he can't really compromise any data... (You can hijack sessions, but you could solve this by storing the users IP with the session information. (If the stored ip and the user's ip don't match, destroy the session and make the user verify himself again.))
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

+ Reply to Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. get 20 credits per post
    By galaxyAbstractor in forum The Marketplace
    Replies: 15
    Last Post: 05-24-2008, 01:54 PM
  2. Hope my post is in the right section?
    By gabama in forum Free Hosting
    Replies: 3
    Last Post: 09-19-2007, 09:01 AM
  3. Post size limit - Still not working
    By deadimp in forum Free Hosting
    Replies: 7
    Last Post: 07-23-2007, 09:20 PM
  4. Replies: 6
    Last Post: 03-27-2005, 12:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers