Jump to content

Search In Database on clicking image.


indyphp

Recommended Posts

Hello ...

 

  I have created a simple html page that has a text box column and a submit like button which is an image. I need to display one column from my table in MySQL database upon submit/click of that image. Searching on the internet i found that we cannot connect to database directly and need to use php script inside html so i have coded it as attached. Also my another requirement is when I am able to retrieve the records I need to display another page with a text "${value from the column in db} Records found in database".

 

Page HTML:

//This is the searchable box wherein I need to key in a value//

<INPUT ID="Forms Edit Field1" TYPE=TEXT NAME="SearchBx_0"  SIZE=26 MAXLENGTH=15 >

 

//This is the image I need to use it to fetch the records from database upon clicking the image//

<IMG ID="Picture23" HEIGHT=37 WIDTH=158 SRC="file:///D:/Test/Preview/Autogen/a_butnov.jpg" BORDER=0 ALT="TESTCHK" TITLE="TESTCHK"

 

The php that I have coded is attached which I have embedded inside the tag of image.

When I do preview site and click the image it says error on page 'F_doLoaded' undefined

 

Could you please help me in rectifying the code.

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

Since you haven't given things that are needed for a complete answer. This will point you in the right direction.

Add this between the lines indicated.

$result = mysql_query($sql);  // between here

$HowMany = mysql_num_fields($result);
while ($row = mysql_fetch_row($result)){
for($Number = 0; $Number < $HowMany; $Number++)
	echo "$row[$Number]".'<br />';
}
echo " Records found in database."; // And here

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.