Jump to content

Drop Down List Box Help


stefani21

Recommended Posts

Helllo Every1

well im kinda new to php and i needed some help i was working on a page all my text boxes and check boxes are at the bottom of my file and like this

		//======================================================================
	</script>

	</head>
<body>

			<div style="margin-left: 170px">
		<input type="checkbox" id="getitems" checked value="1">Run Plugin?  <input type="checkbox" id="sellitm" checked value="1">Sell Items?<br><br>
		Item Name:<br><input type="text" id="itemd" value=""><br><br>How Many Cycles?:<br><input type="text" id="runtm" value="10"></div>
			<div style="margin-left: 170px"><br>
			 <button id="btn_save" style="color:white;background-color:#00660F;border-width:1px;border-style:solid; ">  Save settings </button>
			</div>

                ';

			echo $this->ObjectTable();
			echo '




</body>
</html>
	';
    }
}

?>

and well i decided to do away wit one of the text boxes and use a drop down list instead that is populate from a text file

and the only code that i could find that i was able to get working was this 1

<?php

$text = file_get_contents("itemlist.txt");
$array = explode("\n",$text);
echo "<select>";
foreach ($array as $value) {
echo "<option value='$value'>$value</option>";
}
echo "</select>";

 

and the problem im having is with that one it just stays at the top of the page when loaded like i have no way to position it... and im really stuck i tried saving it in another php and i tried using <?php include(); ?> function but it did not work if any1 could help me out that would be awsome. T.I.A  :D

 

 

Link to comment
Share on other sites

If I understand you this is a layout problem right? at least that's what i make up when you say 'it stays at the top' (php doesn't do anything with that)

Maybe put a container div around the stuff you echo, give it an #id  and position it like you normally would with css.

I don't really see what php has to do with this as far as echo-ing the stuff out.

 

so in other words do the following.

in php file

echo '<div id="my_table">'.$this->ObjectTable().</div>';

 

in css file

div#my_table{
float:left; /* in case you want it to be floated left but depends on your template */
}

 

but i can really recommend you stop using those inline styles and start using an external stylesheet.

Link to comment
Share on other sites

well theres 2 other pages of php that go to this this is just my php for controlling layout and a couple other things lol so yeah it kind of is a layout question i guess . Sorry im new to the forums aswell so i might have posted in the wrong section  :-[

 

but il try out what you said and see if it works.

Link to comment
Share on other sites

If I understand you this is a layout problem right? at least that's what i make up when you say 'it stays at the top' (php doesn't do anything with that)

Maybe put a container div around the stuff you echo, give it an #id  and position it like you normally would with css.

I don't really see what php has to do with this as far as echo-ing the stuff out.

 

so in other words do the following.

in php file

echo '<div id="my_table">'.$this->ObjectTable().</div>';

 

in css file

div#my_table{
float:left; /* in case you want it to be floated left but depends on your template */
}

 

but i can really recommend you stop using those inline styles and start using an external stylesheet.

i made a little error in my code above it should be

echo '<div id="my_table">'.$this->ObjectTable().'</div>';

instead of

echo '<div id="my_table">'.$this->ObjectTable().</div>';

 

Link to comment
Share on other sites

Uhm well it's kinda hard to see what is going wrong, without seeing source code and stuff. (did you noticed my edit above btw?)

 

Maybe instead of bputting the div in your echo (which should normally work) try the following.

 

your index.php

<?php error_reporting(E_ALL);
ini_set("display_errors", 1); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />       
        <title></title>
    </head>
    <body>
        <?php include 'yourfile.php';//without allready echo it ?>
        <div id="wrapper">
            <div id="header">
                
            </div>
            <div id="content">
                <?php echo $your_variable_from_your_includefile; //this could be a spot where you echo the variable (= your box) ?>
            </div>
            <div id="footer">
                
            </div>
        </div>
    </body>
</html>

As you can see a simple mark-up as a framework. with an include of your processing or function file. Notice my comment that you don't want the echo there, but you assign the value you like to output to a variable, which you eventually output in the spot you choose. that way you keep it clean.

 

Add some css in an external style sheet and this should just work if that processing or function file worked before. I assume that worked before right? Also notice the Stuff in the top of the script, we want full error reporting when testing files.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.