Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Picking up regular HTML table data in PHP

Posted by: bowlesj Mar 10 2019, 01:57 AM

Hi, I have some code which works to transfer a column of table data to php. I show the HTML and part of the php below.

HTML creating the HTML web page:

CODE
echo("<td ><input type='textbox' name='fooMelody[]' value='$ParticipateMelody' readonly style='width:10px' onclick='funcInsertM(this.value,$CurrRow)'></td>\n");


PHP recieving the data from the web page
CODE
$RowCnt=0;
foreach($_POST['fldKFSongNumber'] as $fldKF_SongNumber){
      $fldKF_SongNumber = TestInput($con,$_POST['fldKFSongNumber'][$RowCnt]);
      $fooMelody = TestInput($con,$_POST['fooMelody'][$RowCnt]);
      $RowCnt=$RowCnt + 1;
}

As you can probably tell from the POST the table is inside a form.

I now have a need now to transfer the song name down to PHP. However it is not part of an input textbox but rather inside an anchor as shown below.
CODE
echo("<td><a href='/BIAB/$fldKF_BIAB_File' download>$fldSNF_SongName</a></td>\n");


So I tried this
CODE
echo("<td><a name='fooSongName[]' value='$fldSNF_SongName' href='/BIAB/$fldKF_BIAB_File' download>$fldSNF_SongName</a></td>\n");

along with this in PHP
CODE
fooSongName = TestInput($con,$_POST['fooSongName'][$RowCnt]);

and it says it cannot find $_POST['fooSongName'][$RowCnt]).

I tried a couple of things without success. One included trying it with a different column that is not an input text box but also does not have href (that failed). I also read over the anchor <a> and it does not seem to have a value attribute. I even went as far as doing a google search "how can I put a not condition in a google search" thinking I would do what I often do which is to put generic parts of the command into the google search but this time require that the word "input" not be found. Unfortunately there seems to be no such google search command. So once again sneaky determined John comes up with a work around solution to his lack of knowledge. I could create a hidden column in the table which has the input textbox format with a duplicate of the song name info (I recently learned how to create hidden columns). But I am betting there is a better way. Is there?

Any help would be appreciated.

Thanks,
John

Posted by: CharlesEF Mar 10 2019, 06:09 PM

Why not just use a 'hidden' text input? By only posting bits of code I can't offer more detailed information. Do I understand correctly, when you click 'Submit' you want the song title sent to PHP also?

Posted by: bowlesj Mar 10 2019, 10:14 PM

QUOTE(CharlesEF @ Mar 10 2019, 06:09 PM) *

Why not just use a 'hidden' text input? By only posting bits of code I can't offer more detailed information. Do I understand correctly, when you click 'Submit' you want the song title sent to PHP also?


Hi Charles, thanks for your response and yes your assumption is correct. They check selected check-boxes for selected songs in the list and for those ones I want to send them an email so they have a record of what songs they check boxed. I guess the only solution is the one you suggested. I was reading a help page on it and I gather the html table I was trying to set up can only be done with input text boxes, select drop downs and one other I can't remember at the moment. Oh well. At least I know.

It occurred to me earlier today that normally if you wanted to do what I am doing you would get it from the mysql database while processing the page with php. In that situation I would need the key to come down and it would be hidden but it would need to be in an input text box to.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)