but the input is too long so i tried to use textarea…and it stopped working…
i changed input for description to: echo "<td>". " <textarea type=text name=Description value= >'".$row['Description']."'</textarea> </td>";
No, I don’t see that causing your problem - I probably should have marked my post off-topic. However, even for internal use, we all make typing mistakes so validation would help to spot them, and if it’s for a college project, I would hope the tutor would expect you to validate your inputs.
Quite aside from quoting parameters being a good habit, there’s no “value” parameter for a textarea, you just put the value between the open and close tags. But you have single-quotes after the end of the opening tag, as well. This is what html I suspect it will output, given a description of “this is a test”:
<td><textarea type=text name=Description value= >'this is a test'</textarea> </td>
So, lose the single-quotes, drop the “type=” and “value=” sections and stick quotes around the name value, does that help?
Now you’ve extended the input field to a textarea, is the column in your database table sufficiently large to hold the contents?
If none of the above helps, can you be a bit more specific when you say “BUT NOT WORKING WITH TEXTAREA”? Does it not store the text you enter, not draw the textarea correctly, how far through the code does it get? Does it retrieve the form value?
NOT WORKING means that ANY of the columns updates after i make changes and hit UPDATE button
however when use input for description column , it UPDATES CHANGES
Another thing to check is that the text you enter in the textarea is properly sanitised before you use it. As you’re not using a prepared statement and just putting the $_POST variable directly into the query string, if it’s got one or more single quote characters, that will mean your query now has a syntax error. So as @Gandalf said above, you need to make sure that can’t happen with any of the fields before you process the query.
You’ve also got this line twice:
$result= mysqli_query($con, "SELECT * FROM Treatments WHERE Type ='body-wrap'");
after each if() clause to check for update or delete routines. I guess the idea was to re-run the query after you’ve processed update or delete options, but there’s no need to do it twice. It’s outside the if() check, so both will run regardless of which option was selected.
I’m surprised no has mention putting a table inside a form element. I think if you get rid of the table you could see the problem(s) easier. You can stylize a form tag just easily to fit the design you want.
While not the style you want doing it the following should make it easier to stylize.
I also thinking mixing PHP and HTML is messier than having them separated, but that is a personal choice. However, having HTML on top of HTML makes for harder debugging in my opinion.
Yes. I told you back in post #9 that you’ve got single quotes inside the code you use to draw the textarea. Those single quotes become part of the text, and cause the problem you have. I must admit I didn’t see that it would cause the problem, though I did mention that single-quotes inside the text will do, in post #11.