Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing pages with OUT using GET

Status
Not open for further replies.

sd0t1

IS-IT--Management
Mar 14, 2007
131
US
Is this possible?

I build a dynamic list of links from a database field.
All the links point to the process.php page and all have the "id" number attached to them so that when it gets to the process.php page it can be properly processed.

example:process.php?id=<echo $row_link['list_id'];?>

Is it possible to pass this information with out using GET and with out it being seen in the URL?

Thanks Guys.
 
Why don't you use 'FORM POST' then..

Code:
<form action="process.php" method="POST"..>
<input type="hidden" name="id" value="<? echo $row_link['list_id'];?>
<input type="submit" name="submit" value="submit">
</form>


--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
as spookie says - use POST.

the neatest way to do things is to convert all links into javascript snips. have the form hidden and use the javascript to insert the right id value into the form. then submit the form. this means that you don't have to code a form for every link.

alternatively, just go with the get function, on the receiving end store the id in a session variable and then redirect to the index page, retrieve the id and process as normal. it's a bit more clunky though.
 
jpadie, can you give an example of what you mean? how do i make a link that's been clicked on assign the id to a session variable before it leaves the page?
 
Code:
<script>
function submitMe(id, action){
 document.getElementById('idvalue') = id;
document.getElementById('action') = action;

 document.getElementById('myForm').submit();
}
</script>
<!--- hidden form --->
<form method="post" action="<?=$_SERVER['PHP_SELF']?>" id="myForm">
<div style="display:none">
<input type="text" name="id" id="idvalue"/>
<input type="text" name="action" id="action"/>
</div>
</form>
<!--- end of hidden form --->

<a href="#" onclick="submitMe('someID', 'showsomething'); return true;">SomeID</a>
 
I hate to be so ignorant, and I appreciate your patience you've shown me on the board.
Ok, let me see if I understand this

<script>
function submitMe(id, action){
document.getElementById('idvalue') = id;
document.getElementById('action') = action;

document.getElementById('myForm').submit();

the code in red goes in the header and simply get's the vaues from the form fields???


}
</script>
<!--- hidden form --->
<form method="post" action="<?=$_SERVER['PHP_SELF']?>" id="myForm">
<div style="display:none">
<input type="text" name="id" id="idvalue"/>
<input type="text" name="action" id="action"/>
</div>
</form>
<!--- end of hidden form --->




the code in blue creates a hidden form that has the id i'm trying to pass to the next page and the action which i'm not sure what it is used for.




<a href="#" onclick="submitMe('someID', 'showsomething'); return true;">SomeID</a>




code in green ,i understand this it the link i see on the screen, but what is the # for and should this go inside the form??

once again, thanks and sorry for not catching this quickly.
 
the action:
i was trying to show you that you could pass more than just a single variable

the #
just leave as is. it just stops the link from taking you to another page.

the colours are fine except i assume you mean the <head> tag rather than the header.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top