Pass variables via POST in a link

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Pass variables via POST in a link
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Hey everyone,

I'm working on a module that tracks IT Support Request tickets. The end user can enter their ticket ID and click on a "Modify" button to POST the variables back allowing them to edit the ticket. I would like to remove the button and allow the user to simply click on the ticket ID (in a table that pulls from SQL) and post back.

Can you POST from link with javascript? I'd really like to avoid using a button, it would clutter things up.

Any help is appreciated.

MJ




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Look in the buttom form for the passed variable and add it into your link:


<input type=hidden name=ticket_id value=1>


So link would be:


&ticket_id=1




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
I've got several variables that are currently being passed with a submit button (POST). I would like to replace the button with a link. Does that make sense?




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Sure does. Post the code from the button and I will show you what I mean.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: Pass variables via POST in a link
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Here's one example from the code:

echo "<tr><td></td><td><textarea rows=\"8\" cols=\"100\" name=\"new_notes\"></textarea></td></tr>"
  ."<tr><td></td><td align=left><input type=\"submit\" value=\"Submit\"></td></tr>"
  ."<input type=\"hidden\" name=\"op\" value=\"new\">"
  ."<input type=\"hidden\" name=\"old_notes\" value=\"$modify_notes\">"
  ."<input type=\"hidden\" name=\"ticket_id\" value=\"$modify_ticket_id\">"
  ."<input type=\"hidden\" name=\"ticket_type\" value=\"$modify_ticket_type\">"
  ."<input type=\"hidden\" name=\"priority\" value=\"$modify_priority\">"
  ."<input type=\"hidden\" name=\"subject\" value=\"$modify_subject\">"
  ."<input type=\"hidden\" name=\"submitter\" value=\"$modify_submitter\">"
  ."</form></table>";


I've tried coding in a link like this:

<a href=\"$module_name&op=new&old_notes=$modify_notes....etc">Click here</a>


And it goes to the desired page with all the variables in the URL, but it's not passing them to the page (ie triggering other code that is normally triggered by a submit button).

The general idea behind the code is a table that contains a list of support requests. As it stands right now, the only way to get in and append an existing ticket is type in the ticket_id and click the submit button. I'd like to replace that button by converting the respective ticket_id in the table to a hyperlink that passes the same variables. Thanks for looking Telli.



_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#6   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
You will have to add every variable in that form into the link.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#7   
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
I've done that but it doesn't seem to work. I see the variables in the url but it's not executing the code in the file the way the button does. Thanks for looking.




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#8   re: Pass variables via POST in a link
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Well for some crazy reason, I had to pull the POST data out using a new variable

$variable = $_POST['variable'];


Just thought I'd post a follow up in case any one had a similar issue.



_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum