Valhalla Legends Forums Archive | Web Development | PHP Question

AuthorMessageTime
FrostWraith
There will be no code because I haven't the slightest idea of how I will do this. But what I am working on is a Control Panel for my customer. What she needs done is a page where she can see all the artists she has in the database which she can checkmark which to edit (DONE). When all selected artists are checked, their names are sent in POST data to another page which displays the VALUES in input text boxes. This will be so she can change the name of the artist if she misspelled them when she added them. Problem is when I do the php/mysql update, i dont know how to specify the WHERE parameter. I would do WHERE name = '$last_name' but the last name gets lost and only the edited name gets passed along. How would I go about sending along the original name along with the edited one (or an ID as each artist has an ID field)?
December 4, 2006, 4:06 AM
Ersan
You don't really make any sense, the first part of your story is irrelevant and the last sentence isn't logical, how does the 'last name' get lost, and what does it mean to be 'passed along', how and why are you handling an original and edited name in the query?
December 4, 2006, 5:12 AM
FrostWraith
OK, sorry for geing unclear.

Page 1:
Which artists would you liek to edit?
-I check Dali
-I check Picasso
->Send both names in POST Data to page 2

Page 2:
Make any changes you would like to their names:
<inputbox value=$_POST['chkDali'] type="text">
<inputbox value=$_POST['chkPicasso'] type="text">
->Send new post data to page 3

Page 3:
Yay, I have new names, but how do I know which old ones to update?!
December 4, 2006, 5:17 AM
Ersan
afaik inputbox isn't a valid html tag, try input, and you assign them names and use foreach like I assume you did the first time.
December 4, 2006, 5:23 AM
FrostWraith
@Ersan: They do have names, that waas just to help u with an example. And actually the names are decriptive (containing orig name) and if i could recover the names, it would solve my problem (i have a nice function that can do take the name of the variable and mak it a string).

and yes i use foreach:
[code]foreach($_POST as $key => $value) {
$$key = $value;
echo $_POST[$key];
}[/code]
Thats not really mine, but u get the point.

@topaz: eh? edit: delete ur post eh?
December 4, 2006, 5:27 AM
Ersan
[quote author=FrostWraith link=topic=16106.msg162141#msg162141 date=1165209473]
<inputbox value=$_POST['chkDali'] type="text">
<inputbox value=$_POST['chkPicasso'] type="text">
[/quote]

Use something like "name='Dali'" when constructing this HTML and the original name will be the key in foreach.

also:
[code]$$key = $value;[/code]
wtf?
December 4, 2006, 5:36 AM
FrostWraith
Got it! Thank you for telling me the name was in the key, i didn't realize that.  I'm fairly well versed in php, but havent learned qutie all its functions.
December 4, 2006, 5:59 AM
rabbit
Give each entry a unique ID and use that as the form object name.
December 4, 2006, 11:54 AM

Search