Jump to content

Function appears in the wrong place


gos1

Recommended Posts

hi. I need some help on including a function.
[code]
function echo_rooms_button(){
        $get_room_types_qr = "SELECT * FROM rooms";
        $get_room_types = mysql_query($get_room_types_qr);
            for($i =0 ; $i < mysql_num_rows($get_room_types); $i++) {
                    $type = mysql_result($get_room_types,$i,"type");
                    $fee = mysql_result($get_room_types,$i,"fee");
                    print '<label>'.$type.'->'.
                    $fee.'

                    <input name="rooms" type="radio" value="'.$type.'" />
                    </label><br>
                    ';

                    }
}
[/code]
here is the function I like to include but when I echo a text and this function the output of the function appears always on top. ex:
[code]
echo "a text here".echo_rooms_button();
[/code]
I got first the echo_rooms_button()'s output and then the a text here. But when I try this with time() function I got firstly the text and then the time() functions output. Can anyone help me what is wrong with my function ??
Link to comment
https://forums.phpfreaks.com/topic/30346-function-appears-in-the-wrong-place/
Share on other sites

[code]function echo_rooms_button(){
$get_room_types_qr = "SELECT * FROM rooms";
$get_room_types = mysql_query($get_room_types_qr);
for($i =0 ; $i < mysql_num_rows($get_room_types); $i++){
  $type = mysql_result($get_room_types,$i,"type");
  $fee = mysql_result($get_room_types,$i,"fee");
  $retun .= '<label>'.$type.'->'.$fee.'<input name="rooms" type="radio" value="'.$type.'" /></label><br>';
}
return $return;
}[/code]
sorry... typo
[code]function echo_rooms_button(){
$get_room_types_qr = "SELECT * FROM rooms";
$get_room_types = mysql_query($get_room_types_qr);
for($i =0 ; $i < mysql_num_rows($get_room_types); $i++){
  $type = mysql_result($get_room_types,$i,"type");
  $fee = mysql_result($get_room_types,$i,"fee");
  $return .= '<label>'.$type.'->'.$fee.'<input name="rooms" type="radio" value="'.$type.'" /></label><br>';
}
return $return;
}[/code]

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.