2

I have this input form which goes like this:

<input type="checkbox" name="vehicle" value="Bike" />

I want to print it inside this variable:

$return .= '<div class="flink">'.$checkbox.'</div>';

or can i assign it to any other variable?

How can i do it? I tried putting :

$checkbox.= '<input type="checkbox" name="vehicle" value="Bike" />';
Albana
  • 61
  • 1
  • 1
  • 9

3 Answers3

1

Just add:

$return = '<div class="flink">'.$checkbox.'</div>';
echo $return; // Somewhere on the page.

It looks like you're defining it fine, you just may not be echoing it out on the page.

MultiDev
  • 10,389
  • 24
  • 81
  • 148
  • Hey, one question, i've got $return .= ''; how can i add even the $checkbox, to appear? – Albana Jun 27 '12 at 12:41
0

If you're looking to print a variable to the webpage, you can use several different commands.

  • The echo command is useful when the variable is HTML.
  • The var_dump command is useful for debugging purposes, as it works on all kinds of variables.
  • print_r is also nice, because it formats the output in a way that's readable.
SomeKittens
  • 38,868
  • 19
  • 114
  • 143
  • `$return .= '';` You can concatenate multiple strings in one command. Then use one of the print functions I linked to. – SomeKittens Jun 27 '12 at 12:40
0
         <?php
                $q="select * from stores";
                $res=mysql_query($q);
                $StoreOPtion = '<option value="">--select--</option>';
                while($rs=mysql_fetch_object($res))
                 { 
                 $StoreOPtion .= '<option   value="'.$rs->StoreId.'||StoreName:'.$rs->StoreName.'..  Street:'.$rs->StoreStreet.'..Phone:'.$rs->StorePhone.'..Email:'.$rs->StoreEmail.'..Area:'.$rs->StoreArea.'..Pin:'.$rs->StorePincode.'">'.$rs->StoreName.'</option>';

                } 
                ?>
        <select name="StoreName" type="text" id="StoreName"  onchange="getStoreAdd()"/>
       <?php echo $StoreOPtion; ?>
         </select>

Here i am using dropdown box. ypu sehe this example and use it

Vinoth Kumar
  • 93
  • 1
  • 1
  • 8