• Welcome to Valhalla Legends Archive.
 

PHP Question

Started by FrostWraith, December 03, 2006, 10:06 PM

Previous topic - Next topic

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)?

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?

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?!

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.

FrostWraith

#4
@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:
foreach($_POST as $key => $value) {
$$key = $value;
echo $_POST[$key];
}

Thats not really mine, but u get the point.

@topaz: eh? edit: delete ur post eh?

Ersan

#5
Quote from: FrostWraith on December 03, 2006, 11:17 PM
<inputbox value=$_POST['chkDali'] type="text">
<inputbox value=$_POST['chkPicasso'] type="text">

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

also:
$$key = $value;
wtf?

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.

rabbit

Give each entry a unique ID and use that as the form object name.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.