There is a form for displaying a message, in it you can change a certain part by means of the select tag, which drops the value into the base. Question: how to refresh the page without meta refresh, and even better to update only this piece of code?
The code looks like this:

... таблица <td><!-- нужно обновить этот вывод, остальное не важно:) --><?echo $s['s']; ?><br /> <form method=post> <select name="s"> <option value=s1>s1</option><option value=s2>s2</option><option value=s3>s3</option> </select> <input type=submit> </form> <? //подключение к БД бла бла бла if(!result) { echo mysql_error(); } else { echo "все чих пых!"; } ?> 
  • Ie the idea is that the user chooses something from the select'a select'a and immediately loads something on the page, I understand correctly? - Zowie
  • Ugums, just by default, you need to reload the page again so that the user can see the update result in the database. You can of course put the output in for example if (post empty) output else the post is not empty to hit the base to get a "fresh" ... but this is IMHO nonsense ... <br /> I do not see the secret meaning in meaningful bydlokodinge. - DemoriaN
  • and what's in the if (empty ($ _ POST)) construct? I don’t understand actually frankly, what is the "bylokodderstvo" here? The more so, depending on this data, as I understand it, roughly 2 different types are formed ... This is a logical separation of the code into true and false ... If you want so much, the only option I see when using select'a is to catch innerHTML option'a onclick and Ajax to pull, but why so difficult? .. <br> To not need to reload the page again, you can do it yourself in your server code, and not invent a feature :) - Zowie
  • That is, it will be normal, what will be performed in fact 2 requests to the database? for 1 value ?? If we assume that this will be done by 2 people, then it is normal .. and if 2000? and if at the same time? so why load the script once again? but unless of course there is no other option ... <br /> <br /> an example, when you write here, you don’t update the page after the post, you immediately see the result of yours , so to say "work" - DemoriaN
  • it is reasonable ... write something in response .. with me + and the correct answer. - DemoriaN

1 answer 1

What are you talking about? The question of the number of requests to the database here and in general? Those. according to your 1 script = 1 request or how, I just did not understand your idea ...
If somewhere and an extra request is executed on the server, then this is a problem of the server code but not the form and if (empty ($ _ POST)) construction ...

Frankly, it just seems to me that you wrote something wrong (roofing felts on ignorance, roofing felts for some other reason) on the server and are now looking for how to "hide" the problem instead of doing everything as normal ... And even if I wrote this to you above done by js, forward :)