Frezzwar Posted April 25, 2011 Share Posted April 25, 2011 Okay. I think this will be the last time I am asking for help with this project. But i may be wrong. First. How do i make a drop-down box? Normally i try google. Then i try php.net. This time i found nothing. What to do? The plan is that the "items" in the dropbox are the persons in my database. This player needs to be stored, and sent to another page. Problem number 2. When a player is registered, an admin needs to accept that player. My plan is to make a while function make a table to each person who needs to be accepted. He can then click a submit button and a value is changed in the database. Problem is, I can't make it save a variable of who needs to be edited, so no changes are made. Any suggestions? (I connect to the database in navbar.php) <?php include("navbar.php"); if ($admin<2) //altså er man en normal bruger { die ("Du har ikke rettigheder til at se denne side!"); } else if(isset($_POST[$row['username']])) { $username=$row['username']; $queryacc = "UPDATE users SET rank='1' WHERE username='$username'"; } $connect = mysql_connect("localhost","root",""); mysql_select_db("eksamen - phoenix"); $query = mysql_query("SELECT * FROM users WHERE rank='0'"); while($row = mysql_fetch_assoc($query)) { echo "<form action='admin.php' method='POST'> <table> <tr> <td> ".$row['username']." </td> <td> ".$row['email']." </td> <td> ".$row['real_name']." </td> <td> <input type=\"submit\" name=".$row['username']." value=\"Register\"> </td> </table> </form> "; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/234716-two-questions-one-about-submit-buttons-and-one-about-drop-down-boxes/ Share on other sites More sharing options...
Fadion Posted April 25, 2011 Share Posted April 25, 2011 Look, don't want to be harsh or something, but just tell you the way it works. Everyone who's serious about learning web development, before ever touching a programming language, should learn HTML and CSS first. HTML, at least, is priority. Developing PHP applications without knowing what markup to print, is like cooking food without ingredients (stupid example, but gives the idea). So, first learn HTML and the important and not so important tags and attributes, which should take no more than 2-3 days of your time. After that, you'll be ready to go for your PHP career. To answer your questions. Dropdowns in HTML are created with the select and option tags: <select name="something"> <option value="abc">ABC</option> <option value="def">DEF</option> </select> For the second question, I basically gave you the answer in this thread. Using checkboxes in each user row is the most simple way of administering data, as the admin can change a bunch of users with a few clicks. In contrast, buttons for every user will be a hell of a work if there are 200 users to change. Just keep in mind the fact that checkboxes (and also other input tags) can be treated as arrays and you're good to go. Also, in the case of checkboxes you don't need to print a form tag for every user; it just needs one form (you'll have to put it before the while). Quote Link to comment https://forums.phpfreaks.com/topic/234716-two-questions-one-about-submit-buttons-and-one-about-drop-down-boxes/#findComment-1206159 Share on other sites More sharing options...
fugix Posted April 26, 2011 Share Posted April 26, 2011 i agree with gear...you definitely should/need to learn at least a couple base laguages before you shoudl tackle php..php is useless if you do not know the basics of HTML, CSS etc.. Quote Link to comment https://forums.phpfreaks.com/topic/234716-two-questions-one-about-submit-buttons-and-one-about-drop-down-boxes/#findComment-1206186 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.