OK, here's a weird one (js/php/form/action/button)

EdFred

Taxi to Parking
Joined
Feb 25, 2005
Messages
30,651
Location
Michigan
Display Name

Display name:
White Chocolate
So I have a form that reads from a txt file does a bunch of parsing and displays my inventory.

Code:
<div class="space">
<form method='post' action='inventory.php'>
<table class="table2">
$searchid = $_POST["itemsearch"];
I have a textbox
Code:
<td width="225">Search: <input type="text" name="itemsearch" size = "10"></td>
where you could search in the datafile

Code:
while (($line = fgetcsv($f)) !== false) {
        foreach ($line as $cell) {
        $linecount = $linecount + 1;
        $qtycount = $linecount;
        $data = explode(";",$cell);
        $mfgr = $data[0];
        $item = $data[1];
        $quan = $data[2];
        $unit = $data[3];
        $pnum = $data[4];

$numcheck = stripos($pnum, $searchid);        
$itemcheck = stripos($item, $searchid);
and it will only display lines containing your search string.

Code:
elseif ($itemcheck !== false or $numcheck !== false) {
lots of echo code in here
}
This all worked fine and dandy until yesterday when inside the table I added this:

Code:
echo "<input id=\"q$qtycount\" size=4> <button type=\"button\" onclick=\"javascript:myFrameWrite('$linecount');\">Add</button></td>";
Now the search box doesn't work. Everything else does.

Any ideas?

If anyone wants the link I can PM it.
 
Last edited:
Nevermind. I figured it out.

I moved the <form method='post' action='inventory.php'> to just before the textbox and </form> just after it, and it solved the problem.

Odd that you can't have buttons inside a form. Weird.
 
Odd that you can't have buttons inside a form. Weird.

I thought everyone knew that buttons go on the outside. It's one of the ways I use to tell whether or not I have put on my shirt inside-out...
 
I thought everyone knew that buttons go on the outside. It's one of the ways I use to tell whether or not I have put on my shirt inside-out...

I'm not evolved enough to wear shirts with buttons. I have to stick with tshirts, and even those are labeled front/back/inside/outside.
 
Nevermind. I figured it out.

I moved the <form method='post' action='inventory.php'> to just before the textbox and </form> just after it, and it solved the problem.

Odd that you can't have buttons inside a form. Weird.

You can have buttons inside a form.

Have you tried Chrome's developer tools (Ctrl + Shift + J) to see if something is getting parsed wrong during the echo? I always screw up the syntax when I'm echo'ing html - especially the 'onclick' stuff.
 
You can have buttons inside a form.

Have you tried Chrome's developer tools (Ctrl + Shift + J) to see if something is getting parsed wrong during the echo? I always screw up the syntax when I'm echo'ing html - especially the 'onclick' stuff.

I don't use Chrome anymore, but FireFox showed no errors. The buttons worked inside the form. What didn't work was the textbox/post action when the buttons were inside the form.
 
Back
Top