Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SEARCH AND RESULT IN THE SAME PAGE

Guest
Jul 22, 2007 Jul 22, 2007
Hi,

Using: mySQL, PHP, DW

As I have the results appearing on the same page as search function, the show if recordset is empty will not properly work, since the "No Records Match Your Criteria" message will appear as soon as you open the page.

how do I get this message to only show after the user have searched?

Hope someone can point me out a solution for this,
MEM
TOPICS
Server side applications
667
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 22, 2007 Jul 22, 2007
oicram wrote:
> As I have the results appearing on the same page as search function, the show
> if recordset is empty will not properly work, since the "No Records Match Your
> Criteria" message will appear as soon as you open the page.

This is a failing of the way the Show if recordset is empty server
behavior, but it's easy to remedy.

> how do I get this message to only show after the user have searched?

The code as inserted by Dreamweaver looks like this (recordsetName will
be replaced...
Translate
LEGEND ,
Jul 22, 2007 Jul 22, 2007
oicram wrote:
> As I have the results appearing on the same page as search function, the show
> if recordset is empty will not properly work, since the "No Records Match Your
> Criteria" message will appear as soon as you open the page.

This is a failing of the way the Show if recordset is empty server
behavior, but it's easy to remedy.

> how do I get this message to only show after the user have searched?

The code as inserted by Dreamweaver looks like this (recordsetName will
be replaced by whatever name you gave your recordset):

<?php if ($totalRows_recordsetName == 0) { // Show if recordset empty ?>

Change it like this:

<?php if (array_key_exists('submitButtonName', $_POST) &&
$totalRows_recordsetName == 0) { // Show if recordset empty ?>

Replace submitButtonName with the name of the submit button in your
search form. That's all there is to it.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 22, 2007 Jul 22, 2007

<?php if (array_key_exists('submitButtonName', $_POST) &&
$totalRows_recordsetName == 0) { // Show if recordset empty ?>

Thanks a lot. Its precious to know php at least make a if with a nice array_key_exists. :)

I have change the $_POST to $_GET since my form is getting, and it works perfectly.

Thanks a lot.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 23, 2007 Jul 23, 2007
LATEST
oicram wrote:
> I have change the $_POST to $_GET since my form is getting, and it works
> perfectly.

Glad to have been of help.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines