trying to make a survey for school yearbook, need help

Thread Solved

Join Date: Dec 2007
Posts: 63
Reputation: dani190 is an unknown quantity at this point 
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

trying to make a survey for school yearbook, need help

 
0
  #1
Dec 29th, 2007
Hey guys, i just registered here. I have always read posts here but never thought to register.

Anyways, i am looking for some help with this script. So i have about 300 students that all need to be placed in option statements (html). I need these names then put into a drop down menu for students to choose. The issue is, i have maybe 30 questions, which means that i have a hell of a long script. Is there anyway using mysql to import these names whenever i need them into a drop down menu? Also i plan to get the script to submit to a mysql database, what is the easiest way to do that and will allow me to extract the choices the easiest?

And last thing i need to know how from those names i submit into the database to use them also in my verification script. I would liek to generate random passwords for all the users then have them printed out and handed out to the students for them to login. How can i get that done? Also how do i hook it up to a login page?



Thanks so much, Dani.
Last edited by dani190; Dec 29th, 2007 at 7:34 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 1
Reputation: deccanbazaar is an unknown quantity at this point 
Solved Threads: 1
deccanbazaar deccanbazaar is offline Offline
Newbie Poster

Re: trying to make a survey for school yearbook, need help

 
0
  #2
Dec 30th, 2007
well i can make one for you please do let me know by email my email is info[at]kmwsoftech.com
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 63
Reputation: dani190 is an unknown quantity at this point 
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: trying to make a survey for school yearbook, need help

 
0
  #3
Jan 1st, 2008
is there no one here that can give me some help with this?

I don't wish to have the program written for me.....
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 4
Reputation: r4ccoon is an unknown quantity at this point 
Solved Threads: 1
r4ccoon r4ccoon is offline Offline
Newbie Poster

Re: trying to make a survey for school yearbook, need help

 
0
  #4
Jan 1st, 2008
its a basic php operation, you can learn it by your self..
first is create student table, after that create question table
and in your application you can loop the student in dropdown menu, and you can figure something
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 63
Reputation: dani190 is an unknown quantity at this point 
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: trying to make a survey for school yearbook, need help

 
0
  #5
Jan 2nd, 2008
ok so basically i am making a questions table and a name table. Then running code to take that info and export to the survey. Any good places to learn this stuff?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: trying to make a survey for school yearbook, need help

 
0
  #6
Jan 2nd, 2008
So i have about 300 students that all need to be placed in option statements (html). I need these names then put into a drop down menu for students to choose.
If you have these 300 students info in a table, then just fetch their info by using loops. Say, for example, you have student table with their info. You get the dropdown by doing something like this.
  1. <?php
  2. $conn=mysql_connect($host,$username,$pass);
  3. mysql_select_db($dbname);
  4. $query="select student_name from student";
  5. $result=mysql_query($query);
  6. echo "<select name=\"student_name\">";
  7. while($row=mysql_fetch_array($result)){
  8. echo "<option value=".$row['student_name'].">".$row['student_name']."</option>";
  9. }
  10. ....

This will put all the student names in the select box.

The issue is, i have maybe 30 questions, which means that i have a hell of a long script. Is there anyway using mysql to import these names whenever i need them into a drop down menu?
30 questions ? What 30 questions ? About your second question, yes, you can write a function and whenever you need values from the table, you can call that function.

Also i plan to get the script to submit to a mysql database, what is the easiest way to do that and will allow me to extract the choices the easiest?
If you want to submit the user's input to a table, you do it using an insert statement. When the user submits the page, the form variables are accessed as $_POST['variable_name'] or $_GET['variable_name'] depending upon the method you want.

And last thing i need to know how from those names i submit into the database to use them also in my verification script. I would liek to generate random passwords for all the users then have them printed out and handed out to the students for them to login. How can i get that done? Also how do i hook it up to a login page?
You will find a lot of scripts on the net to generate random password. If you want a simplest random password generator, have an array of alphanumerics. (a-z A-Z 0-9). Generate a random number and fetch that array element.

Cheers,
Nav
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: rudevils is an unknown quantity at this point 
Solved Threads: 9
rudevils rudevils is offline Offline
Junior Poster in Training

Re: trying to make a survey for school yearbook, need help

 
0
  #7
Jan 3rd, 2008
hi dan maybe u can check php.net theres a good resources to learn it, and u can download php manual there ....
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 63
Reputation: dani190 is an unknown quantity at this point 
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: trying to make a survey for school yearbook, need help

 
0
  #8
Jan 10th, 2008
Originally Posted by nav33n View Post
If you have these 300 students info in a table, then just fetch their info by using loops. Say, for example, you have student table with their info. You get the dropdown by doing something like this.
  1. <?php
  2. $conn=mysql_connect($host,$username,$pass);
  3. mysql_select_db($dbname);
  4. $query="select student_name from student";
  5. $result=mysql_query($query);
  6. echo "<select name=\"student_name\">";
  7. while($row=mysql_fetch_array($result)){
  8. echo "<option value=".$row['student_name'].">".$row['student_name']."</option>";
  9. }
  10. ....

This will put all the student names in the select box.


30 questions ? What 30 questions ? About your second question, yes, you can write a function and whenever you need values from the table, you can call that function.



If you want to submit the user's input to a table, you do it using an insert statement. When the user submits the page, the form variables are accessed as $_POST['variable_name'] or $_GET['variable_name'] depending upon the method you want.



You will find a lot of scripts on the net to generate random password. If you want a simplest random password generator, have an array of alphanumerics. (a-z A-Z 0-9). Generate a random number and fetch that array element.

Cheers,
Nav
Ok so about this i made the table and entered all the data. Its in a table called grads and there are rows called user_id. I want to retrieve user_id for the drop down menu.

also how do i now generate random passwords for everyone? I made a field called password in the mysql just i don't know how to generate the random password
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: trying to make a survey for school yearbook, need help

 
0
  #9
Jan 10th, 2008
Replace student_name with user_id in the query that I have given above. Then change, $row['student_name'] to $row['user_id'].

As I said earlier, generating random password is easy. Check this site. Use that function in your script.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 63
Reputation: dani190 is an unknown quantity at this point 
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: trying to make a survey for school yearbook, need help

 
0
  #10
Jan 11th, 2008
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
  6. </head>
  7.  
  8. <body>
  9. <form action="handle.php" method="post">
  10.  
  11. <fieldset><legend>Please complete the following questions. Thanks!</legend>
  12.  
  13. <label>1. Be on the price is right</label><br />
  14. <select name="priceisright">
  15. <option value="">Please Choose One Person</option>
  16. <option value="">Not Voting</option>
  17. <?php
  18. $conn=mysql_connect($host,$username,$pass);
  19. mysql_select_db($dbname);
  20. $query="select user_id from student";
  21. $result=mysql_query($query);
  22. echo "<select name=\"student_name\">";
  23. while($row=mysql_fetch_array($result)){
  24. echo "<option value=".$row['user_id'].">".$row['student_name']."</option>";
  25. }
  26.  
  27. ?>
  28.  
  29. </select>
  30. <br />
  31.  
  32.  
  33. </body>
  34. </html>
  35.  

But it doesnt seem to work. Sorry i am bugging you so much but i am quite new to php
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC