PDA

View Full Version : Changing "input type buttons into "anchor type button"


joonstar
04-24-2003, 10:15 PM
<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">

<input type="submit" name="item" value="toy">

</FORM>


The above code does work well,

If I click the button, the SearchList.php page will show every data that included the word "toy".

However, this time I don't like the looking of input type button.
I like the HTML button.

So I tried change the code as follow.


(trial1)
<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<a href=SearchList.php name=item> toy</a>

</FORM>


(trial2)
<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<input type="hidden" name="item" value="toy">
<a href=SearchList.php> toy</a>

</FORM>


Both of trials doesn't work.
They lead the SearchList.php to show not only every data that iinclude the word "toy" but also all data from mysql.

I think that The URL(SearchList.php) comes two times in "FORM action" and "A href" is not logical.

I hope you help me that into logical and workable.


I don't know this is the matter of HTML stuff, PHP, or mysql.
Anyway, I put this one here in HTML catagory.

I've experienced some of my postings was moved into another
catagory.


I know your intention. and my faults.

I'll think about the catagory again when I post a new matter.

When I met your moving for the first time,
That was very embarrasing.

It took much time to find where was my posting.
Now I can find my posting without wasting of my time by using your search box.
although the your moving into another catogory happen.

If you listen to me, I like to suggest two things.

(1) warning before moving for 1 or two times.
(2) explaing why the posting is not a HTML stuff but a javascript stuff. or why the key issue of the posting is not a javascript stuff but PHP stuff,

I think Catagorizing itself can be greater teaching than the main issue.

Oops,
Today, I was too talkative.

Have a good day!

x_goose_x
04-24-2003, 10:22 PM
try:

<input border="0" src="pic.gif" name="my_img" width="200" height="200" type="image">

or:

<a href="javascript: document.search.submit();"><img border="0" src="file.gif"></a>

Note: There is no space in the word javascript, the forum adds it automatically

joonstar
04-24-2003, 11:12 PM
I don't choose your first try because I don't like image button (Actually there are not only "toy" button but so many buttons.
I can't draw the amout of button)

So, I choosed your second try with a little change from image into text .

Next were my trials.
All of them says "error on the page"

"Error on the page" is not the wording the alert message said because it is my translation into English from my mother tongue.



(Trial1)

<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<input type="hidden" name="item" value="toy">
<a href="javascript: document.search.submit();">toy</a>

</FORM>


(Trial2)

<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<a href="javascript: document.search.submit();">toy</a>

</FORM>



(Trial3)
<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<a href="javascript: document.group.submit();">toy</a>

</FORM>



(Trial4)
<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<a href="javascript: document.item.submit();">toy</a>

</FORM>


What's wrong?
or
Is there any suggestion?

x_goose_x
04-25-2003, 04:52 AM
trial 1 and 2 work for me. Do you have multiple forms on the same page? What browser are you using?

joonstar
04-25-2003, 05:45 AM
Yes, I think it might be multiple forms.


<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="0">
<input type="submit" name="item" value="toy">

</FORM>

<FORM name=search action="SearchList.php" method="POST">

<input type="hidden" name="group" value="1">
<input type="submit" name="item" value="fruit">

</FORM>



The SearchList.php has next code


if($group=='0')
$strWhere .= " and (postColumn1 like '%tank%' or postColumn1 like '%gun%')";

if($group=='1')
$strWhere .= " and (postColumn1 like '%apple%' or postColumn1 like '%grape%')";
.....


I apologize I didn't wirte the issue fullly.

If a user click the input type button "toy",
The SearchList.php will show every post that has the word "tank" or "gun".

In this multiple form case,
How can I do ...?

Mhtml
04-25-2003, 07:15 AM
<a href="javascript: document.formName.submit()">Toys</a>

Replace the text in blue with the name of the form you wish to submit.

joonstar
04-25-2003, 09:28 AM
Anyway, I think this is too hard for me.
I might have to give up this time.
something is so twisted in my code.


Thanks to all.

x_goose_x
04-25-2003, 01:01 PM
Yuo can't have two forms with the same name in the same document.