The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Picking up regular HTML table data in PHP
bowlesj
post Mar 10 2019, 01:57 AM
Post #1


Novice
**

Group: Members
Posts: 27
Joined: 11-June 15
Member No.: 22,710



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

This post has been edited by bowlesj: Mar 10 2019, 02:17 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Mar 10 2019, 06:09 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
bowlesj
post Mar 10 2019, 10:14 PM
Post #3


Novice
**

Group: Members
Posts: 27
Joined: 11-June 15
Member No.: 22,710



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.

This post has been edited by bowlesj: Mar 10 2019, 10:16 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 01:27 AM