stefani21 Posted February 6, 2011 Share Posted February 6, 2011 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 Link to comment https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/ Share on other sites More sharing options...
fortnox007 Posted February 6, 2011 Share Posted February 6, 2011 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 https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170586 Share on other sites More sharing options...
stefani21 Posted February 6, 2011 Author Share Posted February 6, 2011 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 https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170588 Share on other sites More sharing options...
fortnox007 Posted February 6, 2011 Share Posted February 6, 2011 start a topic in de css forum and ill help you position it. I can't move this post - edit and if this is your layout php (also to be referred as a template) use only the html mark-up and strategically place includes and echo's as if they were modules Link to comment https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170589 Share on other sites More sharing options...
stefani21 Posted February 6, 2011 Author Share Posted February 6, 2011 Ok. Will do Thank You For Your Help! =] Link to comment https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170590 Share on other sites More sharing options...
fortnox007 Posted February 6, 2011 Share Posted February 6, 2011 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 https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170593 Share on other sites More sharing options...
stefani21 Posted February 6, 2011 Author Share Posted February 6, 2011 omg i dont get it i dont know what im doing wrong i tried that and now it gives me a syntax errors like when i try n use the div it invalidates the code for the drop down box or something im so confused Link to comment https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170599 Share on other sites More sharing options...
fortnox007 Posted February 6, 2011 Share Posted February 6, 2011 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 https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170603 Share on other sites More sharing options...
stefani21 Posted February 6, 2011 Author Share Posted February 6, 2011 ok i will go ahead and try that and il post back with what happens, also i guess i should have mentioned that its not stored on a website they are addons for an application so they are stored locally. Link to comment https://forums.phpfreaks.com/topic/226866-drop-down-list-box-help/#findComment-1170611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.