提交表单后不按字母顺序排序

Posted

技术标签:

【中文标题】提交表单后不按字母顺序排序【英文标题】:Not sorting alphabetically after submit the form 【发布时间】:2017-06-23 11:20:56 【问题描述】:

我已经对城市的下拉菜单进行了排序。它的排序正确,但是在单击提交按钮后,它们的顺序不是按字母顺序排列的。 查询:

$cities = $wpdb->get_results( "select ID, post_title from $wpdb->posts where post_type = 'place' and post_parent = $state_id", ARRAY_A );

【问题讨论】:

在查询中使用ORDER BY子句,并在您的问题中添加更多代码,这将有助于我们更好地理解您的问题。 【参考方案1】:

使用下面的代码希望对你有帮助-

$cities = $wpdb->get_results( "select ID, post_title from $wpdb->posts where post_type = 'place' and post_parent = $state_id ORDER BY post_title ASC", ARRAY_A );

了解更多https://codex.wordpress.org/Class_Reference/wpdb

【讨论】:

以上是关于提交表单后不按字母顺序排序的主要内容,如果未能解决你的问题,请参考以下文章

怎么实现form表单提交后不重新刷新当前页面

如何在表单提交后保留文本(如何在提交后不删除自身?)

ASP中用submit提交表单后不清空文本框的内容,怎么做?

form.submit();在 DOM 中“刷新”表单后不起作用。控制台提示:表单提交已取消,因为表单未连接

如何在 form 表单提交后实现页面不跳转

关于form表单提交数据后不跳转页面+ajax接收返回值的处理