<p>current ID is: $pid</p>
<input type='submit' value='Change Order' />
</form>
As you can see, I am listing the title of the event then I'm listing the ID of that row (variable of $pid). I also have a row called displayorder and have made a variable of that. Then I show the title and name the text field the ID ($pid). I then display the current order that particular event is displayed.
What I would like to do is for my user then change the display order since on the display page I am calling from MySql to order by display order ASC.
My problem is, since I'm naming my text field $pid (ID) and it's in a fetch array, once I send it to my parse.php I can't very well declare a new variable using $pid since it's in a fetch array.
Hence I can't update mysql because I can't get the info into a variable as I would like. I tried to echo $pid for the name and that didn't work.
Or perhaps I should scrap this method completely and someone else may have a better idea of how I can list the title of the event then change the order (displayorder in my database).
Like I said, it should be very simple to change that one item but it has me scratching my head. Right now there's only 5 events so it's not a huge database at this point. But the while loop was the easiest way for me to list everything there.
OK. I need to scrap this way of doing this completely so need other ideas. It dawned on my I was echo'ing $pid so when I looked for it in the parse script it wasn't seeing $pid it was seeing 13 which was the value of $pid (did a limit of 1 for testing). Now there's no way of me knowing a year from now what the value of a certain ID is going to be so no way to call for it when I parse the data.
Who has a great plan for me being able to change the order of display (displayorder in my database)? Other than the obvious just going in there and doing it myself. This is a CMS and needs to be idiot proof for office workers.
You're using the input name as a variable where it should be a constant (so you know what it is). Input fields go by name/value pairs. When you process them, you grab the value that is associated with that name. What you should have is name="DisplayOrder" value="$displayOrder" If you need to access the $pid variable, you could use input type="hidden" name="pid" value="$pid"
Then, in your parse script you can use $pid=$_POST['pid']; $displayOrder=$_POST['DisplayOrder'];
Bookmarks