08-04-2003, 12:24 PM | #1 (permalink) |
Insane
|
HTML question
Man, remember HTML? Me neither.
So, the dilly is thus...I've created a site using PHP and MySQL, and I need to pass variables from one page to another. Right now, I use forms with the POST method for most of it, but occasionally, I need a normal old hyperlink. My question...is there a way to use POST with a hyperlink? Right now, I have something like Code:
showSingle.php?id=74&name=test&other=thing... Any ideas? I guess I could use a frameset, and basically just hide ALL of the URLs, but that sucks, and I do want to use GET for some, so people can bookmark pages, etc. MPEDrummer
__________________
My sig can beat up your honor student. |
08-04-2003, 01:21 PM | #2 (permalink) |
Psycho
Location: Oregon
|
Why do you need to use the link to post? Using the link exactly like you have it will transfer the variables from page to page.
the link.php?info=variable system works fine.
__________________
"It's not that I don't understand, it's that I don't care" - Homer Simpson |
08-04-2003, 03:17 PM | #3 (permalink) |
Insane
|
Two reasons...
#1 -> I don't necessarily want people to be able to link directly to certian pages. Using POST for those pages would prevent that. #2 -> It's messy. I also don't want people to be able to see all the variables. MPEDrummer
__________________
My sig can beat up your honor student. |
08-04-2003, 04:31 PM | #4 (permalink) |
In Your Dreams
Location: City of Lights
|
You can't use POST with links.. exactly...
I had this same problem, I solved it by: - Create a FORM (sounds like you already have). - Make the variables you want to put in hidden items in the form. - Don't put a submit button on the page. - The link that you want to submit with should be coded something like this: >A HREF="javascript:forms[0].submit;"< you should be able to replace the "forms[0]" with the form name. Also, reverse the ><'s obviously. Clicking on that HREF should run your FORM's Submit action without them having to click a button. You could also create a function that receives variables, set's the FORM's (already existing) HIDDEN inputs, and then runs submit on the form. That allows you to have dynamic FORMs. If you want me to explain some more, let me know. I found that once you get it working, it's great. |
08-04-2003, 08:48 PM | #6 (permalink) |
Guest
|
That's a pretty messy way of going about it - I think there's a reason that almost everyone uses URL querystrings when they code something dynamic like that.
I know that I thought about working on workarounds for that sort of thing once, but I abandoned it when it because apparent how much time it was going to take to do so. I think there's a forum package out there somewhere that allows you to not show querystrings in the URL, but I don't remember which one. |
Tags |
html, question |
|
|