Form Button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
anthony88guy
Forum Contributor
Posts: 246
Joined: Thu Jan 20, 2005 8:22 pm

Form Button

Post by anthony88guy »

I have my code display for example 20 items in rows. I want each row to have a update button that is linked to something like 'users.php?mode=whatever' How do make a button link to a page, I could always use an image. But just wondering. Do i have to make a whole <form> for each button?
User avatar
Cinder
Forum Newbie
Posts: 6
Joined: Sun Apr 17, 2005 2:09 pm
Location: Uknown

Post by Cinder »

I think you can use some JavaScript

Code: Select all

<script language=&quote;JavaScript&quote; type=&quote;text/javascript&quote;>
function Goto(value)
{
   window.laction=&quote;index.php?page=&quote;+url;
}
and then add:

Code: Select all

<input type=&quote;button&quote; onClick=&quote;item025&quote;>
Last edited by Cinder on Sun Apr 17, 2005 3:13 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there are many ways. A form for each is one. A simple image linked is another. There are some variations that can do Javascripted stuff, but the basics remain the same. You set of the form to use that button as a submission in some fashion.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Post by Phoenixheart »

I encountered this before, and this is how I dealed: For each row I echoed:

Code: Select all

echo("<a href='deletepage.php?code=" .$row['CODE']. "' target=_blank><img source='delete.gif'></a>");
Then when you click on that "delete" image, it will open a new window that contains the file deletepage.php. This file will accept the code and then do deleting the product with that code.
I think your problem should be solved similiar. :wink:
anthony88guy
Forum Contributor
Posts: 246
Joined: Thu Jan 20, 2005 8:22 pm

Post by anthony88guy »

thxs, But thats how I am doing it, with images. :D
Post Reply