Jump to content


Photo

Using Rollovers As 'Submit' Buttons And Passing Values?


  • Please log in to reply
3 replies to this topic

#1 jhale1966

jhale1966
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 13 June 2003 - 08:47 PM

First off, sorry for the crosspost, but I wasn\'t sure which one to put this in. I\'m using Dreamweaver but the function is Javascript.

Since starting to use DW (6.1) - I\'ve been changing my Form Submit buttons into Graphic Rollovers and they work great if I need to go from page to page:

<form name=\"activatedok\" method=\"post\" action=\"index.php\">
<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage(\'Image1\',\'\',\'./images/button-sdragon.gif\',1)\"><img name=\"Image1\" border=\"0\" src=\"./images/button-return.gif\" onclick=\"document.activatedok.submit()\"></a>
</form>

Now I\'ve come to a point that I need to actually PASS a variable to another php file like a normal Submit button but I can\'t figure out how to do it. :/ The statement that would need to pass would be:

<form name=\"purchase_guide\" method=\"post\" action=\"purchase.php\">
<font color=\"#FFFFFF\" size=\"3\" face=\"Times New Roman, Times, serif\"><strong><em>Only 1 Allowed Per Game</em></strong></font><br>
<a onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage(\'Image6\',\'\',\'./images/button-sdragon.gif\',1)\"><img name=\"Image6\" border=\"0\" src=\"./images/button-buy.gif\" onclick=\"document.purchase_guide.submit()\"></a>
</form>

And I would need to pass (to \'purchase.php\') the values of:

value=\"Buy Guide\" name=\"buyitem\"

How would I do this?

Thanks! :)

#2 Elisse

Elisse
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 10 July 2003 - 05:20 PM

hi,

well, i think so, you\'d use some like this...

<form name=\"purchase_guide\" method=\"post\" action=\"purchase.php?value=\'Buy Guide\'&name=buyitem>
<font color=\"#FFFFFF\" size=\"3\" face=\"Times New Roman, Times, serif\"><strong><em>Only 1 Allowed Per Game</em></strong></font><br>
<a onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage(\'Image6\',\'\',\'./images/button-sdragon.gif\',1)\"><img name=\"Image6\" border=\"0\" src=\"./images/button-buy.gif\" onClick=\"document.purchase_guide.submit()\"></a>
</form>

Change this line... in action=\"purchase.php?value=\"buy guide\"&namebuyitem

Like this...

<form name=\"purchase_guide\" method=\"post\" action=\"purchase.php?value=\'Buy Guide\'&name=buyitem>

and test it...

remember retrive whit $value= $_GET[\'value\']; or $value= $_REQUEST[\'algo\']; in purchase.php idem for name

i hope that work correctly :)
Elisse, Unbreakable

#3 LiamG

LiamG
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts
  • LocationMelbourne, Australia

Posted 11 July 2003 - 09:28 AM

You can\'t do that, sorry.

Instead, try using a \"hidden\" field:
<input type="hidden" value="Buy Guide" name="buyitem">
And, also remember register_globals.

HTH, LiamG.

#4 jhale1966

jhale1966
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 11 July 2003 - 11:12 AM

That\'s what I ended up doing and it works like a charm! :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users