reading name field from a 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
michaelk46
Forum Commoner
Posts: 67
Joined: Mon Oct 12, 2009 9:50 pm

reading name field from a button

Post by michaelk46 »

Here is what I am trying to do...

I currently have a search function that pulls page information from a MySQL databse and displays page id, pagename, etc... with one record being displayed on each line.
There is an edit button on each line that when you click it will pull up the specifics of that page so I can edit them and then save them back to the database. I am currently storing the pageid of each record in the name field of the button on each line so I can use that to pull up the specifics of that record and I have verified that the correct id number is being stored in that field of the corresponding button.

What is the best way to read the name field so I can do a search using it on the database... or is there a better way to accomplish my goal?

Thanks all....
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Take a look at the SQL LIKE statement:
http://www.w3schools.com/SQl/sql_like.asp
michaelk46
Forum Commoner
Posts: 67
Joined: Mon Oct 12, 2009 9:50 pm

Re: reading name field from a button

Post by michaelk46 »

Thank You for the reply,

I understand the MySQL side of it... Where the problem lies is actually reading the name field of the button which contains the parameter I will use for the search.

Let's say below is the HTML code for the button I clicked on....

<input type="submit" name="12345" value="Edit"/>

I need a way in PHP to read the actual number that is in the name field. I can't do a test for a certain string that might be there because it is dynamically created and can different everytime the script is run.

Sorry for the confusion, I should have been more clear to begin with.
Post Reply