|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
My problem here is that:
I have a page that displays comments made by users for the CURDATE(). Users use a pop up window to add comments in which there are 2 drop down, 1 text box and 1 radio button. Now, My challenge here is that I have to let them edit it. I dont know how when he clicks edit button, a popup window again pops up with the data that was already there. And then he can make changes and submit and the comments page should also refresh. Please can someone help me? My pop up code is: PHP Code:
So how can we do this one? |
|
#2
|
|||
|
|||
|
Could you explain more about your problem? I'm not sure exactly what is or isn't happening for you.
|
|
#3
|
||||
|
||||
|
Shruti,
Did you see that you have your connection variables assigned different values than the values you have in your mysql_connect? Is this on purpose, or an oversight?
__________________
FREE Web Development Videos | PHP Reference | MySQL Reference | jQuery Documentation Markup Validation | CSS Validation | Web Developers, get FireBug & IE Developer Toolbar When seeking help: Submit clear questions and code. Use syntax highlighting. Be patient, and respectful. Don't abuse your access to professional guidance - nobody here is obligated to answer your questions, be thankful that they do. Are you a good person? |
|
#4
|
||||
|
||||
|
Sorry, thats a mistake.......!!
The problem here is that I do not know how to go about this problem. I have a page that lets you enter data and another page that displays those entered data. Now how do I edit them (i know by putting a button)? The page that enters data has 3 drop down, 1 text box and 1 radio button. How can I edit those?Can someone help me please? |
|
#5
|
|||||
|
|||||
|
Study this for ideas. Wrote it just for you
![]() Warning, no testing has been done - wrote this here in this message window so there could be some small errors - it's not meant to be copy/pasted, but studied instead. This opens up a security issue too. You need to verify that the user editing the comment is the owner of the comment. php Code:
|
|
#6
|
|||
|
|||
|
You can send information etc back to the mainpage, but using the opener tag.
ie: on mainpage.php you could have var foo in the popup you could use: opener.foo = "blah"; i am assuming this is what you're on about? If not, Sorry ![]() HTH. Mike |
|
#7
|
||||
|
||||
|
Thanks a lot sampson for making such an effort.
The issue that you are pointing(users can edit only his comments) is also an issue that I already had in mind. Also sorry to mention but I am still not able to explain my self. Ok, let me take it from the top. I have a page that enters comments(data) and another that displays it. Now I want to let users edit their own comments(data). Now I cannot just put them into the text box because 3 values comes from drop down and one from radio button. So if say you display EDIT button after all the comments of the current user. Now when he clicks it how can I get dropdowns, radio with their present values and allow them to edit? Am I making sense now? |
|
#8
|
||||
|
||||
|
Jadi,
You were making sense from the beginning ![]() You're looking at everything together, which makes this much more complicated than it really is. First things first. You want to pass a variable to the edit.php page that will be used to lookup a previously entered comment. On that page, let's make a function that can get all of the data related to that comment from the database so we can display it on our page. What does the comments table in your database look like? |
|
#9
|
|||
|
|||
|
Quote:
yep, Just make the form with the same Data (+ the extra data) that they can change (either in the popup, or a new page). Then make it post back to the original page on sumbit (which obviously would refresh when the new data is sent). If you are using the popup method, you can still send the information that has to be passed through via the URL in the window.open request.. or just in the link ifyou are going to be using the same window. Using the Popup window you can just submit back to _parent if needs be. There are quite a few ways of doing this.. the best way is for you to describe exactly how you want to acheive the desired result (frontend wise), and we can point you in the right direction towards acheiving it ![]() |
|
#10
|
||||
|
||||
|
COMMENTS
CELLID , problem, solution, comments, username , date ,rf, Cellid is not to be changed so we dont worry about it. Problem comes from drop down. solution comes from drop down. Comments is a simple text box. username comes from the session id. date comes from the curdate function and rf is a radio button of YES/NO. |
|
#11
|
||||
|
||||
|
Can you show a sample of two or three rows of content too?
|
|
#12
|
||||
|
||||
|
INSERT INTO `comments` (`CELLID`, `problem`, `solution`, `comments`, `username`, `date`, `rf`) VALUES
('SI', 'Misc - Hardware related', 'Being Monitered.......', 'switch Investigating', 'pam', '2008-08-14', 'no'), ('NJ5', 'Misc RF', 'Being Monitered.......', 'set Alpha power to 41', 'gb', '2008-08-14', 'no'), ('NJ5', 'Misc - T1 / PCM', 'T1 TT out to Telco', 'VZ found no trouble upon manual testing', 'gb', '2008-08-14', 'no'); |
|
#13
|
||||
|
||||
|
This structure is a little wrong, and will make things harder on you. For example, I noticed that "problem" is likely coming from a list of options, but rather than storing a number that refers to an entry, you're storing the text itself. This isn't really bad, but it requires more space, and makes lookups harder on the server. Same thing goes for usernames - those should probably be integers representing userid's in another table.
Code:
CELLID | Problem | Solution | Comments | Username | Date | rf SI [text] [text] [text] [text] [date] no NJ5 [text] [text] [text] [text] [date] no NJ5 [text] [text] [text] [text] [date] no You should make another table called "problems," and give it the following fields: id, problem Within your comments table, link to the id of the problem, and not the text of the problem. The same goes for users - link to their userid, and not their username itself. Last edited by jsampsonPC : August 14th, 2008 at 09:22 AM. |
|
#14
|
||||
|
||||
|
I was having problem joining the tables. So sorry about that.
So am I having problems??? I cant do it? |
|
#15
|
||||
|
||||
|
It can still be done, but you will be happier in the long-run if you go back and update the tables :P
Is there not a unique id for each comment? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Edit problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|