Jump to content

form buttons as text?


spires

Recommended Posts

Hi,

i'm creating a cms news section, just to see how to do it.

I have almost finished, but was woundering if i can have my links to the articles as text links and not buttons.

I'm not to good at explanning, so please goto:
http://spirestest.com/login2/news

I'm using a for loop to pull the info from the database. The form is within the loop, giving each button its own hidden ID fields.
Taking you to the correct article.

But I would really like them to be text not buttons.

I have tryed:
<A HREF="javascript:document.excel1.submit();">'.$row['title'].'</a>

This work, ONLY if the form is out side the loop. Which is no good.

Any ideas Please.

Thanks for reading.

Here i the block of code:

<?php

$limit=5;
$numresults=mysql_query("SELECT date, title FROM $db_tbl")
or die("query 1 failed");
$numrows=mysql_num_rows($numresults);


if (empty($offset)) {
    $offset=0;
}

$query = "SELECT * FROM $db_tbl ORDER by ID DESC limit $offset,$limit";
$result = mysql_query($query)
or die ("query 2 failed");


echo '<center>';

echo '<table class="TLRB_border" bgcolor="#EEEEEE" width="400"  cellpadding="5" cellspacing="0">';
echo '<TR bgcolor="#CCCCCC">
<TD class="Title" colspan="3">
Select A News Article
</TD>
</TR>';
echo '<tr>
  <td width="30">
  &nbsp;
  </td>
  <td>';
   

$count = mysql_num_rows($result);


if($count < 1) {
echo "No news";
} else {

for ($i = 0; $i < $count; $i++) {
$row = mysql_fetch_array($result);

echo '<form name="excel1" action="news_art.php" method="post">';

      echo "<INPUT type='hidden' name='ID' value='".$row['ID']."'> \n";
  echo "<INPUT type='hidden' name='date' value='".$row['date']."'> \n";
  echo "<INPUT type='hidden' name='title' value='".$row['title']."'> \n";
  echo "<INPUT type='hidden' name='art' value='".$row['art']."'> \n";

echo '<table width="340" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" align="center">
  <tr>
  <td align="center" class="loginBox_text">
  <br>'.$row['date'].'
  </td>
  <tr>
 
<TD align="center" width="50"><A HREF="javascript:document.excel1.submit();">'.$row['title'].'</a><br></TD>';
echo '</form>';
echo '</tr>';
echo '</table>';



}
}
echo '</td>
  <td width="30">
  &nbsp;
    </td>
  </tr>
  </table>';
 
echo '</center>';

 
?>
Link to comment
https://forums.phpfreaks.com/topic/13572-form-buttons-as-text/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.