Sahil
Sahil

Reputation: 1983

How to put two buttons in same line

I need help with the displayed image below. The two buttons "edit and back" button is not being displayed on line. The code for both the button is as below. They are both inside the same <td></td>

<tr><td>
  <input type="hidden" name="token" value="<?php echo $token; ?>"/>
  <input type="submit" name="edit" value="Edit"/>
  <?php
    //create a  back button that takes user back to referer url on click
    if (isset($HTTP_REFERER)) {
      echo '<a href="$HTTP_REFERER"><img src="images/buttons/back.gif" alt="back"></a>';
    } else {
      echo '<a href="javascript:history.back()"><img src="images/buttons/back.gif" alt="back"></a>';
    }
  ?>
</td></tr>

I can't upload the image directly so here is the link where I uploaded the image image source: http://i39.tinypic.com/2miab.png

Upvotes: 2

Views: 2183

Answers (2)

Vad.Gut
Vad.Gut

Reputation: 531

well I noticed that some solutions might work differently in different browsers putting your buttons in another small table without any attributes will keep them in a single line

<table><tr> <td><input type="hidden" name="token" value="<?php echo
$token; ?>"/></td> <td> <?php
//create a  back button that takes user back to referer url on click
if (isset($HTTP_REFERER)) {
echo '<a href="$HTTP_REFERER"><img1 src="images/buttons/back.gif" alt="back"></a>';
} else {
echo '<a href="javascript:history.back()"><img1 src="images/buttons/back.gif" alt="back"></a>';
}
?> </td> </tr></table>

hope this is what you wanted

Upvotes: 2

Dhruvisha
Dhruvisha

Reputation: 2530

try this:

<td>
    <input type="hidden" name="token" value="<?php echo $token; ?>"/>
    <input type="submit" name="edit" value="Edit"/>
</td>
<td>
 <?php
    //create a  back button that takes user back to referer url on click
    if (isset($HTTP_REFERER)) {
        echo '<a href="$HTTP_REFERER"><img src="images/buttons/back.gif" alt="back"></a>';
    } else {
        echo '<a href="javascript:history.back()"><img src="images/buttons/back.gif" alt="back"></a>';
    }
    ?>
</td>

Upvotes: 1

Related Questions