[56K WARN] newbie here - Part management form
Posted: Tue Jul 25, 2006 10:39 pm
feyd | Please use
etc etc
The edit, and delete are both seperate submit buttons (I will probably be changing them to hyperlinks, but not worrying about that right now).
These buttons takes the user to the php page called editParts.php using POST
The problem I have, Is I currently have a pretty bad way on how I am POSTing the partID
I currently have a loop, which writes a new row to the screen for each part, however I give each part its own form
So it basically looks like this
As you can see each part has its own form... which I don't think is a very effiecient way on doing it.
However I do not know how to only make it 1 form, and being able to figure out the partID based on which button they clicked.
I know It would be really easy if I used GET instead of POST, but I want to use POST.
If any of you could point me in the right direction that would be great. Currently the only way I can figure out how to do it is by using GET. But I dont want people typing in the address bar, and changing the part id to whatever they want.
Thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello, I just started using PHP about 2 weeks ago, and while I don't know much of the advanced stuff, I am getting a lot of the basic stuff.
Anyways I ran into a snag in my one page.
I have a part management page, that lists all of the different parts in the database into a table structure (like a datagrid).
The html form looks like thisCode: Select all
<hidden field> PartID | Part # | Part Description | Part Price | Part Cost | Threshold |
------------------------------------------------------------------------------------------
1 | 1111 | Part 1 | 100.00 | 78.0| 4 | Edit Delete
2 | 2222 | Part 2 | 50 | 39 | 10 | Edit DeleteThe edit, and delete are both seperate submit buttons (I will probably be changing them to hyperlinks, but not worrying about that right now).
These buttons takes the user to the php page called editParts.php using POST
The problem I have, Is I currently have a pretty bad way on how I am POSTing the partID
I currently have a loop, which writes a new row to the screen for each part, however I give each part its own form
So it basically looks like this
Code: Select all
for each part
{
<form action="editParts.php" method="post">
<input type="hidden" name="partID" value="<? echo $part->GetPartID() ?>"/>
<td bgcolor="#999999"><? echo $part->getPartDescription() ?> </td>
etc etc
<input type="submit" name="Submit" value="Edit" id="Submit" />
<input type="submit" name="Submit" value="Delete" id="Submit" />
</form>
}However I do not know how to only make it 1 form, and being able to figure out the partID based on which button they clicked.
I know It would be really easy if I used GET instead of POST, but I want to use POST.
If any of you could point me in the right direction that would be great. Currently the only way I can figure out how to do it is by using GET. But I dont want people typing in the address bar, and changing the part id to whatever they want.
Thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]