format for option statment in php...

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

format for option statment in php...

 
0
  #1
Jan 23rd, 2008
hey guys i have this line

  1. $result=mysql_query($query) or die(mysql_error());
  2. $option="";
  3. while($row=mysql_fetch_array($result)) {
  4. $option.="<option value=".$row['firstname; lastname'].">".$row['firstname; lastname']."</option>";
  5. }
Now i need to fetch the last name and first names and put them into those option values...

hows that done? If i go

  1. lastname, firstname

I get nothing, if i just say
  1. firstname
or
  1. lastname

It works perfectly.

any ideas?
Last edited by dani190; Jan 23rd, 2008 at 12:04 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,739
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: format for option statment in php...

 
0
  #2
Jan 23rd, 2008
My suggestion is, always use integer values if you are are updating a table based on the choice made. Because, it ll be easy for you to update.
But I guess your table structure is not that good.. Do you have an autoincrement field(id or counter or anything like that ?). If you do, then you can fetch first name, last name and id of every users, put id for option value.
Eg. say you have id, firstname, lastname in your table.
  1. <?php
  2. //connect
  3. //select db
  4. $query="select id,firstname,lastname from table";
  5. $result=mysql_query($query);
  6. $option="";
  7. while($row=mysql_fetch_array($result)){
  8. $name=$row['firstname']." ".$row['lastname'];
  9. $id=$row['id'];
  10. $option.="<option value=$id>$name</option>";
  11. }
  12. ?>

This will show the first name and last name as a choice, but when selected, it sends the id of that user.

Cheers,
Naveen
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 15
Reputation: njagi is an unknown quantity at this point 
Solved Threads: 1
njagi njagi is offline Offline
Newbie Poster

Re: format for option statment in php...

 
0
  #3
Jan 23rd, 2008
It may be a good idea ti have a unique id to accompany the firstname lastname pair and submit the id instead of the name itself.

for example
<?php

$result=mysql_query($query);

$option="";

while($data=mysql_fetch_array($result)){

$option.="<option value=".$row['ID'].">".$row['lastname']."".$row['firstname']."</option>";

}

?>

this should give id name pair like this.
1 doe john
2 kamau kuria
etc etc
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 62
Reputation: hooray is an unknown quantity at this point 
Solved Threads: 6
hooray hooray is offline Offline
Junior Poster in Training

Re: format for option statment in php...

 
0
  #4
Jan 23rd, 2008
Originally Posted by njagi View Post
It may be a good idea ti have a unique id to accompany the firstname lastname pair and submit the id instead of the name itself.

for example
<?php

$result=mysql_query($query);

$option="";

while($data=mysql_fetch_array($result)){

$option.="<option value=".$row['ID'].">".$row['lastname']."".$row['firstname']."</option>";

}

?>

this should give id name pair like this.
1 doe john
2 kamau kuria
etc etc
Well now thats a unique idea......whoa....whoa....whoa....wait a minit isnt that the exact same thing nav33n just said

I also reccomend adding a user_id field to the table, it makes things a lot easier in the long run.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,739
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: format for option statment in php...

 
0
  #5
Jan 23rd, 2008
Last edited by nav33n; Jan 23rd, 2008 at 2:22 pm.
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: format for option statment in php...

 
0
  #6
Jan 23rd, 2008
ok i got that working but now i am having some issues with querying the first and last names from the database...

Heres the code i have....

  1. <?php
  2.  
  3. // Include the configuration file for error management and such.
  4. // require_once ('/home/.flipside/bullseye/web/design.anblickstudios.com/includes/');
  5.  
  6.  
  7. if (isset($_POST['submitted'])) { // Check if the form has been submitted.
  8.  
  9. require_once ('mysql_connect.php'); // Connect to the database.
  10.  
  11. $errors = array(); // Initialize error array
  12.  
  13. // Validate the first name
  14. if (!empty($_POST['firstname'])) {
  15. $F = escape_data($_POST['firstname']);
  16. } else {
  17. echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
  18. $F = FALSE;
  19. }
  20.  
  21. // Validate the last name
  22. if (!empty($_POST['lastname'])) {
  23. $L = escape_data($_POST['lastname']);
  24. } else {
  25. echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
  26. $L = FALSE;
  27. }
  28.  
  29. // Validate the password.
  30. if (!empty($_POST['password'])) {
  31. $p = escape_data($_POST['password']);
  32. } else {
  33. $p = FALSE;
  34. echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
  35. }
  36.  
  37. if (empty($errors)) { // If everything's OK.
  38.  
  39.  
  40. // Query the database.
  41. $query = "SELECT firstname, lastname FROM grads WHERE (firstname,lastname ='$F,$L' AND password=SHA1('$p')) " or die(mysql_error());
  42. $result = @mysql_query ($query); // Run the Query
  43. $row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable
  44.  
  45. if ($row) { // A record was pulled from the database.
  46.  
  47. // Register the values & redirect.
  48. session_start();
  49. $_SESSION['firstname'] = $row[0];
  50. $_SESSION['lastname'] = $row[1];
  51. $_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
  52.  
  53. // Start defining the URL.
  54. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  55. // Check for a trailing slash.
  56. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
  57. $url = substr ($url, 0, -1); // Chop off the slash.
  58. }
  59. // Add the page.
  60. $url .= '/loggedin.php';
  61.  
  62.  
  63. header("Location: $url");
  64. exit(); // Quit the script.
  65.  
  66. } else { // No record matched the query
  67. $errors[] = 'The name and password entered do not match those on file.';
  68. // Public Message
  69. $errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message
  70. }
  71.  
  72. } // End of if (empty($errors)) IF.
  73.  
  74. mysql_close(); // Close the database connection.
  75.  
  76. } else { // Form has not been submitted
  77.  
  78. $erorrs = NULL;
  79.  
  80. } // End of the main SUBMIT conditional.
  81.  
  82. //Begin the page now
  83. $page_title = 'Login';
  84.  
  85. if (!empty($errors)) { //Print any error messages.
  86. echo '<h1 id="mainhead">Error!</h1>
  87. <p class="error">The following error(s) occurred:<br />';
  88. foreach ($errors as $msg) { // Print each error.
  89. echo " - $msg<br />\n";
  90. }
  91. echo '</p><p>Please try again.</[>';
  92. }
  93.  
  94. ?>
  95.  
  96. <h1>Login</h1>
  97. <p>Your browser must allow cookies in order to log in.</p>
  98. <form action="login.php" method="post">
  99. <fieldset>
  100. <p><b>First Name:</b> <input type="text" name="firstname" size="20" maxlength="40" value="<?php if (isset($_POST['firstname'])) echo $_POST['firstname']; ?>" />
  101. <b>Last Name:</b> <input type="text" name="lastname" size="20" maxlength="40" value="<?php if (isset($_POST['lastname'])) echo $_POST['lastname']; ?>" />
  102. </p>
  103. <p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
  104. <input type="submit" name="submit" value="Login" />
  105. <input type="hidden" name="submitted" value="TRUE" />
  106. </fieldset>
  107. </form>

The exact error i get is

Error!

The following error(s) occurred:
- The name and password entered do not match those on file.
- Operand should contain 1 column(s)

Query: SELECT firstname, lastname FROM grads WHERE (firstname,lastname ='****,****' AND password=SHA1('**************'))

Please try again.
Any ideas?
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: format for option statment in php...

 
0
  #7
Jan 23rd, 2008
Here is the other code... il explain whats going on bellow

Login.php
  1. <?php
  2.  
  3. // Include the configuration file for error management and such.
  4. // require_once ('/home/.flipside/bullseye/web/design.anblickstudios.com/includes/');
  5.  
  6.  
  7. if (isset($_POST['submitted'])) { // Check if the form has been submitted.
  8.  
  9. require_once ('mysql_connect.php'); // Connect to the database.
  10.  
  11. $errors = array(); // Initialize error array
  12.  
  13. // Validate the first name
  14. if (!empty($_POST['firstname'])) {
  15. $F = escape_data($_POST['firstname']);
  16. } else {
  17. echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
  18. $F = FALSE;
  19. }
  20.  
  21. // Validate the last name
  22. if (!empty($_POST['lastname'])) {
  23. $L = escape_data($_POST['lastname']);
  24. } else {
  25. echo '<p><font color="red" size="+1">You forgot to enter First Name!</font></p>';
  26. $L = FALSE;
  27. }
  28.  
  29. // Validate the password.
  30. if (!empty($_POST['password'])) {
  31. $p = escape_data($_POST['password']);
  32. } else {
  33. $p = FALSE;
  34. echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
  35. }
  36.  
  37. if (empty($errors)) { // If everything's OK.
  38.  
  39.  
  40. // Query the database.
  41. $query = "SELECT firstname='$F', lastname='$L' FROM grads WHERE (password=SHA1('$p')) " or die(mysql_error());
  42. $result = @mysql_query ($query); // Run the Query
  43. $row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable
  44.  
  45. if ($row) { // A record was pulled from the database.
  46.  
  47. // Register the values & redirect.
  48. session_start();
  49. $_SESSION['firstname'] = $row[0];
  50. $_SESSION['lastname'] = $row[1];
  51. $_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
  52.  
  53. // Start defining the URL.
  54. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  55. // Check for a trailing slash.
  56. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
  57. $url = substr ($url, 0, -1); // Chop off the slash.
  58. }
  59. // Add the page.
  60. $url .= '/vote.php';
  61.  
  62.  
  63. header("Location: $url");
  64. exit(); // Quit the script.
  65.  
  66. } else { // No record matched the query
  67. $errors[] = 'The name and password entered do not match those on file.';
  68. // Public Message
  69. $errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message
  70. }
  71.  
  72. } // End of if (empty($errors)) IF.
  73.  
  74. mysql_close(); // Close the database connection.
  75.  
  76. } else { // Form has not been submitted
  77.  
  78. $erorrs = NULL;
  79.  
  80. } // End of the main SUBMIT conditional.
  81.  
  82. //Begin the page now
  83. $page_title = 'Login';
  84.  
  85. if (!empty($errors)) { //Print any error messages.
  86. echo '<h1 id="mainhead">Error!</h1>
  87. <p class="error">The following error(s) occurred:<br />';
  88. foreach ($errors as $msg) { // Print each error.
  89. echo " - $msg<br />\n";
  90. }
  91. echo '</p><p>Please try again.</[>';
  92. }
  93.  
  94. ?>
  95.  
  96. <h1>Login</h1>
  97. <p>Your browser must allow cookies in order to log in.</p>
  98. <form action="login.php" method="post">
  99. <fieldset>
  100. <p><b>First Name:</b> <input type="text" name="firstname" size="20" maxlength="40" value="<?php if (isset($_POST['firstname'])) echo $_POST['firstname']; ?>" />
  101. <b>Last Name:</b> <input type="text" name="lastname" size="20" maxlength="40" value="<?php if (isset($_POST['lastname'])) echo $_POST['lastname']; ?>" />
  102. </p>
  103. <p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
  104. <input type="submit" name="submit" value="Login" />
  105. <input type="hidden" name="submitted" value="TRUE" />
  106. </fieldset>
  107. </form>
and...

vote.php

  1. <?php
  2. session_start(); // Start the session
  3. $conn=mysql_connect("*****","*****","****") or die(mysql_error());
  4. mysql_select_db("db33717_gradsurvey") or die(mysql_error());
  5.  
  6. $query="SELECT firstname,lastname FROM grads ORDER BY `grads`.`lastname` ASC" or die(mysql_error());
  7.  
  8. $result=mysql_query($query);
  9. $option="";
  10. while($row=mysql_fetch_array($result)){
  11. $name=$row['firstname']." ".$row['lastname'];
  12.  
  13. $option.="<option value=$name>$name</option>";
  14. }
  15.  
  16. if(isset($_POST['submit'])) {
  17. // Mail Script
  18.  
  19. $a=$_POST['priceisright'];
  20. $b=$_POST['millionaire'];
  21. $c=$_POST['loosepassport'];
  22. $d=$_POST['vanriver'];
  23. $e=$_POST['spusecheat'];
  24. $f=$_POST['marrymoney'];
  25. $g=$_POST['5divorces'];
  26. $h=$_POST['primeminister'];
  27. $i=$_POST['teacheci'];
  28. $j=$_POST['40yearoldvirgin'];
  29. $k=$_POST['livewparents'];
  30. $l=$_POST['dieholdingcell'];
  31. $m=$_POST['damagedliver'];
  32. $n=$_POST['jail'];
  33. $q=$_POST['plasticsurgery'];
  34. $r=$_POST['adoptchildren'];
  35. $s=$_POST['buyfriends'];
  36. $t=$_POST['Dictionary'];
  37. $p=$_POST['eci5years'];
  38. $u=$_POST['guitarhero'];
  39. $v=$_POST['convent'];
  40. $w=$_POST['souljaboywedding'];
  41. $x=$_POST['nobelpeace'];
  42. $y=$_POST['huggerenvironment'];
  43. $z=$_POST['mack'];
  44. $aa=$_POST['ego'];
  45. $ab=$_POST['partier'];
  46. $ac=$_POST['cougar'];
  47. $ad=$_POST['awkward'];
  48. $ae=$_POST['dramtic'];
  49. $af=$_POST['gossip'];
  50. $ag=$_POST['cluts'];
  51. $ah=$_POST['car'];
  52. $ai=$_POST['style'];
  53. $aj=$_POST['hair'];
  54. $ak=$_POST['cutestcouple'];
  55. $al=$_POST['hottestparents'];
  56. $am=$_POST['playboygirl'];
  57. $an=$_POST['kingswaymd'];
  58. $aq=$_POST['funniest'];
  59. $ar=$_POST['athletic'];
  60.  
  61.  
  62. $message = "
  63.  
  64. Name: {$_POST ['$F,$L']}
  65. {$_SESSION ['firstname'] ['lastname']}
  66.  
  67. Price is right: $a
  68. Become a millionaire: $b
  69. Loose Passport: $c
  70. Live in a van: $d
  71. Cheat on Spouse: $e
  72. Marry For money: $f
  73. Divorces: $g
  74. Prime Minister: $h
  75. Teach at ECI: $i
  76. 40 year old Virgin: $j
  77. Live with their parents: $k
  78. Die holding their cell phone: $l
  79. Damaged Liver before 19: $m
  80. End up in jail: $n
  81. Plastic Surgery: $q
  82. Adopt Children: $r
  83. Buy their friends: $s
  84. Memorize the Dictionary: $t
  85. Eci in 5 years: $p
  86. Guitar Hero: $u
  87. Convent: $v
  88. Soulja boy at wedding: $w
  89. Nobel Peace Prize: $x
  90. Tree Hugger/ Environmentally friendly: $y
  91. Biggest Mack: $z
  92. Biggest Partier: $aa
  93. Biggest Partier: $ab
  94. Biggest Cougar: $ac
  95. Most Awkward: $ad
  96. Most Dramatic: $ae
  97. Biggest Gossip: $af
  98. Biggest Cluts: $ag
  99. Best Car: $ah
  100. Best Style: $ai
  101. Best Hair: $aj
  102. Cutest Couple: $ak
  103. Hottest Parents: $al
  104. Playboy/Playgirl: $am
  105. Kingsway Mom and Dad: $an
  106. Funniest: $aq
  107. Most Athletic: $ar";
  108.  
  109.  
  110. mail("ecigrads08@gmail.com","{$_SESSION ['firstname']}{$_SESSION ['lastname']}:Grad Survey 08",$message,"from: dani@anblickstudios.com");
  111.  
  112.  
  113. // Start defining the URL.
  114. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  115. // Check for a trailing slash.
  116. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
  117. $url = substr ($url, 0, -1); // Chop off the slash.
  118. }
  119. // Add the page.
  120. $url .= '/thanks.php';
  121.  
  122. header("Location: $url");
  123. exit(); // Quit the script.
  124.  
  125.  
  126. }
  127.  
  128.  
  129. ?>
  130. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  131. <html xmlns="http://www.w3.org/1999/xhtml">
  132. <head>
  133. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  134. <title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
  135. </head>
  136. <body>
  137.  
  138.  
  139. <?php
  140. // Welcome the user
  141. echo '<h2>Welcome';
  142. if (isset($_SESSION['firstname'] ['lastname'])) {
  143. echo ", {$_SESSION['firstname'] ['lastname']}!";
  144. }
  145. echo '</h2>';
  146. ?>
  147. <b>INSTRUCTIONS:</b>
  148.  
  149. <p>The following are the questions for the 2008 Grad Survey. Please answer all questions
  150. and please only submit this form once. If you submit more than once, your survey will be ignored.
  151. <br />
  152. Once you submit, please logout using the link provided on the "thank you" page.
  153. <br />
  154. Finally The survey will run until the end of March 2008 and there will be NO extensions.
  155. <br /><br />
  156.  
  157. Sincerely,<br />
  158. The Happy ECI Yearbook Team!
  159. </p>
  160.  
  161. <form name="gradsurvey08" action="vote.php" method="post" >
  162. <fieldset>
  163.  
  164.  
  165.  
  166. <Label> <b>Most likely to...</b></Label><br />
  167.  
  168.  
  169. <label>1. Be on the price is right</label><br />
  170. <select name="priceisright">
  171. <option value="">Please Choose One Person</option>
  172. <option value="Not Voting">Not Voting</option>
  173. <?php echo $option; ?>
  174. </select>
  175. <br />
  176.  
  177. <label>2. Become a millionaire</label><br />
  178. <select name="millionaire">
  179. <option value="">Please Choose One Person</option>
  180. <option value="Not Voting">Not Voting</option>
  181. <?php echo $option; ?>
  182. </select>
  183. <br />
  184.  
  185. <label>3. Loose passport in Europe</label><br />
  186. <select name="loosepassport">
  187. <option value="">Please Choose One Person</option>
  188. <option value="Not Voting">Not Voting</option>
  189. <?php echo $option; ?>
  190. </select>
  191. <br />
  192.  
  193. <label>4. Live in a van by the river</label><br />
  194. <select name="vanriver">
  195. <option value="">Please Choose One Person</option>
  196. <option value="Not Voting">Not Voting</option>
  197. <?php echo $option; ?>
  198. </select>
  199. <br />
  200.  
  201. <label>5. Cheat on Spouse</label><br />
  202. <select name="spusecheat">
  203. <option value="">Please Choose One Person</option>
  204. <option value="Not Voting">Not Voting</option>
  205. <?php echo $option; ?>
  206. </select>
  207. <br />
  208.  
  209. <label>6. Marry for money</label><br />
  210. <select name="marrymoney">
  211. <option value="">Please Choose One Person</option>
  212. <option value="Not Voting">Not Voting</option>
  213. <?php echo $option; ?>
  214. </select>
  215. <br />
  216.  
  217. <label>7. have 5 divorces before 30</label><br />
  218. <select name="5divorces">
  219. <option value="">Please Choose One Person</option>
  220. <option value="Not Voting">Not Voting</option>
  221. <?php echo $option; ?>
  222. </select>
  223. <br />
  224.  
  225. <label>8. Be prime minister of Canada</label><br />
  226. <select name="primeminister">
  227. <option value="">Please Choose One Person</option>
  228. <option value="Not Voting">Not Voting</option>
  229. <?php echo $option; ?>
  230. </select>
  231. <br />
  232.  
  233. <label>9. Teach at ECI</label><br />
  234. <select name="teacheci">
  235. <option value="">Please Choose One Person</option>
  236. <option value="Not Voting">Not Voting</option>
  237. <?php echo $option; ?>
  238. </select>
  239. <br />
  240.  
  241. <label>10. Be a 40 year old virgin</label><br />
  242. <select name="40yearoldvirgin">
  243. <option value="">Please Choose One Person</option>
  244. <option value="Not Voting">Not Voting</option>
  245. <?php echo $option; ?>
  246. </select>
  247. <br />
  248.  
  249. <label>11. Live with their parents</label><br />
  250. <select name="livewparents">
  251. <option value="">Please Choose One Person</option>
  252. <option value="Not Voting">Not Voting</option>
  253. <?php echo $option; ?>
  254. </select>
  255. <br />
  256.  
  257. <label>12. Die holding their cell phone</label><br />
  258. <select name="dieholdingcell">
  259. <option value="">Please Choose One Person</option>
  260. <option value="Not Voting">Not Voting</option>
  261. <?php echo $option; ?>
  262. </select>
  263. <br />
  264.  
  265. <label>13. Have a damaged liver before 19</label><br />
  266. <select name="damagedliver">
  267. <option value="">Please Choose One Person</option>
  268. <option value="Not Voting">Not Voting</option>
  269. <?php echo $option; ?>
  270. </select>
  271. <br />
  272.  
  273. <label>14. End up in jail</label><br />
  274. <select name="jail">
  275. <option value="">Please Choose One Person</option>
  276. <option value="Not Voting">Not Voting</option>
  277. <?php echo $option; ?>
  278. </select>
  279. <br />
  280.  
  281. <label>15. Get plastic surgery on their whole body</label><br />
  282. <select name="plasticsurgery">
  283. <option value="">Please Choose One Person</option>
  284. <option value="Not Voting">Not Voting</option>
  285. <?php echo $option; ?>
  286. </select>
  287. <br />
  288.  
  289. <label>16. Adopt children from a 3rd world</label><br />
  290. <select name="adoptchildren">
  291. <option value="">Please Choose One Person</option>
  292. <option value="Not Voting">Not Voting</option>
  293. <?php echo $option; ?>
  294. </select>
  295. <br />
  296.  
  297. <label>17. Buy their friends</label><br />
  298. <select name="buyfriends">
  299. <option value="">Please Choose One Person</option>
  300. <option value="Not Voting">Not Voting</option>
  301. <?php echo $option; ?>
  302. </select>
  303. <br />
  304.  
  305. <label>18. Memorize the Dictionary</label><br />
  306. <select name="Dictionary">
  307. <option value="">Please Choose One Person</option>
  308. <option value="Not Voting">Not Voting</option>
  309. <?php echo $option; ?>
  310. </select>
  311. <br />
  312.  
  313. <label>19. Still be at ECI in 5 years</label><br />
  314. <select name="eci5years">
  315. <option value="">Please Choose One Person</option>
  316. <option value="Not Voting">Not Voting</option>
  317. <?php echo $option; ?>
  318. </select>
  319. <br />
  320.  
  321. <label>20. Become the true Guitar Hero</label><br />
  322. <select name="guitarhero">
  323. <option value="">Please Choose One Person</option>
  324. <option value="Not Voting">Not Voting</option>
  325. <?php echo $option; ?>
  326. </select>
  327. <br />
  328.  
  329. <label>21. Join a Convent</label><br />
  330. <select name="convent">
  331. <option value="">Please Choose One Person</option>
  332. <option value="Not Voting">Not Voting</option>
  333. <?php echo $option; ?>
  334. </select>
  335. <br />
  336.  
  337. <label>22. Dance to Soulja boy at their wedding</label><br />
  338. <select name="souljaboywedding">
  339. <option value="">Please Choose One Person</option>
  340. <option value="Not Voting">Not Voting</option>
  341. <?php echo $option; ?>
  342. </select>
  343. <br />
  344.  
  345. <label>23. Win the nobel peace prize</label><br />
  346. <select name="nobelpeace">
  347. <option value="">Please Choose One Person</option>
  348. <option value="Not Voting">Not Voting</option>
  349. <?php echo $option; ?>
  350. </select>
  351. <br />
  352.  
  353. <label>24. Be the biggest tree hugger/environmentally friendly</label><br />
  354. <select name="huggerenvironment">
  355. <option value="">Please Choose One Person</option>
  356. <option value="Not Voting">Not Voting</option>
  357. <?php echo $option; ?>
  358. </select>
  359. <br />
  360.  
  361. <label><b>Biggest</b></label><br />
  362.  
  363. <label>25. Mack </label><br />
  364. <select name="mack">
  365. <option value="">Please Choose One Person</option>
  366. <option value="Not Voting">Not Voting</option>
  367. <?php echo $option; ?>
  368. </select>
  369. <br />
  370.  
  371. <label>26. Ego</label><br />
  372. <select name="ego">
  373. <option value="">Please Choose One Person</option>
  374. <option value="Not Voting">Not Voting</option>
  375. <?php echo $option; ?>
  376. </select>
  377. <br />
  378.  
  379. <label>27. Partier</label><br />
  380. <select name="partier">
  381. <option value="">Please Choose One Person</option>
  382. <option value="Not Voting">Not Voting</option>
  383. <?php echo $option; ?>
  384. </select>
  385. <br />
  386.  
  387. <label>28. Cougar</label><br />
  388. <select name="cougar">
  389. <option value="">Please Choose One Person</option>
  390. <option value="Not Voting">Not Voting</option>
  391. <?php echo $option; ?>
  392. </select>
  393. <br />
  394.  
  395. <label>29. Awkward</label><br />
  396. <select name="awkward">
  397. <option value="">Please Choose One Person</option>
  398. <option value="Not Voting">Not Voting</option>
  399. <?php echo $option; ?>
  400. </select>
  401. <br />
  402.  
  403. <label>30. Dramatic</label><br />
  404. <select name="dramatic">
  405. <option value="">Please Choose One Person</option>
  406. <option value="Not Voting">Not Voting</option>
  407. <?php echo $option; ?>
  408. </select>
  409. <br />
  410.  
  411. <label>31. Gossip</label><br />
  412. <select name="gossip">
  413. <option value="">Please Choose One Person</option>
  414. <option value="Not Voting">Not Voting</option>
  415. <?php echo $option; ?>
  416. </select>
  417. <br />
  418.  
  419. <label>32. Cluts</label><br />
  420. <select name="cluts">
  421. <option value="">Please Choose One Person</option>
  422. <option value="Not Voting">Not Voting</option>
  423. <?php echo $option; ?>
  424. </select>
  425. <br />
  426.  
  427. <label><b> Best</b></label><br />
  428.  
  429. <label>33. Car</label><br />
  430. <select name="car">
  431. <option value="">Please Choose One Person</option>
  432. <option value="Not Voting">Not Voting</option>
  433. <?php echo $option; ?>
  434. </select>
  435. <br />
  436.  
  437. <label>34. Style</label><br />
  438. <select name="style">
  439. <option value="">Please Choose One Person</option>
  440. <option value="Not Voting">Not Voting</option>
  441. <?php echo $option; ?>
  442. </select>
  443. <br />
  444.  
  445. <label>35. Hair</label><br />
  446. <select name="hair">
  447. <option value="">Please Choose One Person</option>
  448. <option value="Not Voting">Not Voting</option>
  449. <?php echo $option; ?>
  450. </select>
  451. <br />
  452.  
  453. <label> <b>------------------------------------------------------------</b></label><br />
  454.  
  455. <label>36. Cutest Couple</label><br />
  456. <select name="cutestcouple">
  457. <option value="">Please Choose One Person</option>
  458. <option value="Not Voting">Not Voting</option>
  459. <?php echo $option; ?>
  460. </select>
  461. <br />
  462.  
  463. <label>37. Hottest Parents</label><br />
  464. <select name="hottestparents">
  465. <option value="">Please Choose One Person</option>
  466. <option value="Not Voting">Not Voting</option>
  467. <?php echo $option; ?>
  468. </select>
  469. <br />
  470.  
  471. <label>38. Playboy/Playgirl</label><br />
  472. <select name="playboygirl">
  473. <option value="">Please Choose One Person</option>
  474. <option value="Not Voting">Not Voting</option>
  475. <?php echo $option; ?>
  476. </select>
  477. <br />
  478.  
  479. <label>39. Kingsway Mom & Dad</label><br />
  480. <select name="kingswaymd">
  481. <option value="">Please Choose One Person</option>
  482. <option value="Not Voting">Not Voting</option>
  483. <?php echo $option; ?>
  484. </select>
  485. <br />
  486.  
  487. <label>40. Funniest</label><br />
  488. <select name="funniest">
  489. <option value="">Please Choose One Person</option>
  490. <option value="Not Voting">Not Voting</option>
  491. <?php echo $option; ?>
  492. </select>
  493.  
  494. <br />
  495.  
  496. <label>41. Most athletic</label><br />
  497. <select name="athletic">
  498. <option value="">Please Choose One Person</option>
  499. <option value="Not Voting">Not Voting</option>
  500. <?php echo $option; ?>
  501. </select>
  502. <br />
  503.  
  504. <input name="submit" value="submit" type="submit">
  505.  
  506.  
  507.  
  508.  
  509.  
  510. </form>
  511.  
  512.  
  513. </body>
  514. </html>
  515.  

So basically since i added the firstname and lastname stuff i am totally lost. Could you guys give me a hand with modifying my stuff since i have no clue how to do stuff when you have 2 separate things ( instead of having the name in 1 column)

Hope someone can give me a hand.

Thanks again, Dani
Last edited by dani190; Jan 23rd, 2008 at 9:20 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,739
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: format for option statment in php...

 
0
  #8
Jan 23rd, 2008
I guess you didn't see my example ?
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: format for option statment in php...

 
0
  #9
Jan 23rd, 2008
i did but i dont have that id thinggy, nor do i know what to do with it.

What your saying is create an auto inrimental field.

can i still create that even though my database is created and setup?

and then whats that going to do for me?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,739
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 330
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: format for option statment in php...

 
0
  #10
Jan 23rd, 2008
Well, If you dont have an id field, what/how do you plan to update the table ? because, there can be people with same first name and same last name. You need to have an id field. Anyway, you can make use of concat function in mysql to join those 2 fields.
Eg. select concat(firstname,lastname) as name from table;
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
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



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC