OK, I'm lost... don't know if this is easy and I'm missing it, or it can't be done, but this is my favorite place to ask...

I have a table data cell that I would like to have as the submit value (link) in a form in a php script.

Problem is that I have a lot that goes into building that <td...

This is how the cell is created...
(actually there are several of them displayed and each needs to be a form with a separate link)

        <td align='center' width='180' height='100' background="images/<?php print $td_bg[$x];?>.png">
          <b><font color="#E0FFFF"><?php print $sub_count[$x]."-".$y;?></font></b><br />
          <b><font size="+1" color="#FFFFFF"><?php print $sub_count[$x]*$y;?> Subscribers</font></b><br>
<?php
             $z=0;
             while ($sub_count[$x]*$y>$sub_count[$z]){
               $price = round(($sub_count[$x]*$y*($init_sub_cost-$disc_step[$z])),0);
               ++$z;
             }
?>
          <b><font size="+2" color="#1E90FF">$<?php print number_format($price,0); ?></font></b>
        </td>

and here is the form

    <form name="pack_sel" action="order.php" method="POST">
        <input type="hidden" name="subs" value="<?php print $sub_count[$x];?>">
        <input type="hidden" name="ars" value="<?php print $y;?>">
        <input type="submit" name="view" value="Select">
    </form>

Is there a way to make that <td ... /td> the value in the submit?

Thanks in advance for your response

Douglas

Yes, it can be done with JQuery, or you can put your values in hidden inputs.

But why would you want to submit a whole table?? Just asking. Anyways, I think it would be better to just submit the values, and then arrange them in tabular form when retreiving it.

Webville312
it isn't a whole table... it is a table cell, and I just want to make the cell the link so that no matter where they click within the cell, it will submit the form. I can easily use any single item in the cell like the price or the number of subscribers, etc, but just would prefer to use then entire cell if possible.

szabizs
I really don't want to use JQuery if I don't have to, and I don't really understand what you are referring to about putting the values in hidden inputs. That is what I'm already doing.

Thanks for your replies... I'm thinking I may need to go a different direction with this...

What about adding onclick form submit to the cell ??

Yes. guy you are trying <td> for creating a table when you insert a row you may use <tr> for a table row in column. but you have n't specified you are add a cell in existing table or not.?

Thank You artekmc and Geffory for your responses

I did not personally try the onclick form submit, but in my research online I found that others have tried it with no success and have reverted to other options

And yes, the table is structured correctly...
It has 7 rows with 5 columns in each, and display just fine.

I use a background graphic in each <td cell and then have 3 lines of text printed in each cell that is generated by the php script, which is different in each cell.

The only issue is the ability to use each of the table cells as a link in itself, so that when you click anywhere within the cell, it triggers the submit.

It looks like I am not going to be able to achieve that, so I will have to convert one of the text lines in each cell into a graphic version of the same information (probably the price), and then link that graphic as the submit button for each cell

If anyone has any better solutions, please let me know before I go through all the work that will be involved in making this change.

Hoping someone responds with a different option that will save me some time.

Thanks
Douglas

Not really solved, but no suggestions being brought forward, so I will just close it as opposed to leaving it open and forgetting it.

thank

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.