hey you guys have probably seen my other 2 threads but i said they were completed so i decided to create one more for this small problem.
I realized that when i submit my form it sends me only the selected first names for some reason.
Il post my script bellow and if someone can just help me out with that. If i don't get that fixed it will be really quite hard to find out who got chosen for the questions.
Also the weird thing is every other time i use the user id it comes up as the full name as it should.
In my database the user_id holds a name in this form FIRSTNAME LAST NAME
so basically an example is jonh doh
I don't have the first and last names split.
Hope someone can help...
<?php
session_start(); // Start the session
$conn=mysql_connect("**********","********","**************") or die(mysql_error());
mysql_select_db("**********") or die(mysql_error());
$query="select user_id from grads" or die(mysql_error());
$result=mysql_query($query) or die(mysql_error());
$option="";
while($row=mysql_fetch_array($result)) {
$option.="<option value=".$row['user_id'].">".$row['user_id']."</option>";
}
if(isset($_POST['submit'])) {
// Mail Script
$a=$_POST['priceisright'];
$b=$_POST['millionaire'];
$c=$_POST['loosepassport'];
$d=$_POST['vanriver'];
$e=$_POST['spusecheat'];
$f=$_POST['marrymoney'];
$g=$_POST['5divorces'];
$h=$_POST['primeminister'];
$i=$_POST['teacheci'];
$j=$_POST['40yearoldvirgin'];
$k=$_POST['livewparents'];
$l=$_POST['dieholdingcell'];
$m=$_POST['damagedliver'];
$n=$_POST['jail'];
$q=$_POST['plasticsurgery'];
$r=$_POST['adoptchildren'];
$s=$_POST['buyfriends'];
$t=$_POST['Dictionary'];
$p=$_POST['eci5years'];
$u=$_POST['guitarhero'];
$v=$_POST['convent'];
$w=$_POST['souljaboywedding'];
$x=$_POST['nobelpeace'];
$y=$_POST['huggerenvironment'];
$z=$_POST['mack'];
$aa=$_POST['ego'];
$ab=$_POST['partier'];
$ac=$_POST['cougar'];
$ad=$_POST['awkward'];
$ae=$_POST['dramtic'];
$af=$_POST['gossip'];
$ag=$_POST['cluts'];
$ah=$_POST['car'];
$ai=$_POST['style'];
$aj=$_POST['hair'];
$ak=$_POST['cutestcouple'];
$al=$_POST['hottestparents'];
$am=$_POST['playboygirl'];
$an=$_POST['kingswaymd'];
$aq=$_POST['funniest'];
$ar=$_POST['athletic'];
$message = "
Name: {$_SESSION ['user_id']}
Price is right: $a
Become a millionaire: $b
Loose Passport: $c
Live in a van: $d
Cheat on Spouse: $e
Marry For money: $f
Divorces: $g
Prime Minister: $h
Teach at ECI: $i
40 year old Virgin: $j
Live with their parents: $k
Die holding their cell phone: $l
Damaged Liver before 19: $m
End up in jail: $n
Plastic Surgery: $q
Adopt Children: $r
Buy their friends: $s
Memorize the Dictionary: $t
Eci in 5 years: $p
Guitar Hero: $u
Convent: $v
Soulja boy at wedding: $w
Nobel Peace Prize: $x
Tree Hugger/ Environmentally friendly: $y
Biggest Mack: $z
Biggest Partier: $aa
Biggest Partier: $ab
Biggest Cougar: $ac
Most Awkward: $ad
Most Dramatic: $ae
Biggest Gossip: $af
Biggest Cluts: $ag
Best Car: $ah
Best Style: $ai
Best Hair: $aj
Cutest Couple: $ak
Hottest Parents: $al
Playboy/Playgirl: $am
Kingsway Mom and Dad: $an
Funniest: $aq
Most ATheltic: $ar";
mail("dani@anblickstudios.com","Grad Survey 08",$message,"from: dani@anblickstudios.com");
// Start defining the URL.
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// Check for a trailing slash.
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
// Add the page.
$url .= '/thanks.php';
header("Location: $url");
exit(); // Quit the script.
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Etobicoke Collegiate Institute's Grad Survey 2008</title>
</head>
<body>
<?php
// Welcome the user
echo '<h2>Welcome';
if (isset($_SESSION['user_id'])) {
echo ", {$_SESSION['user_id']}!";
}
echo '</h2>';
?>
<form name="gradsurvey08" action="vote.php" method="post" >
<fieldset><legend>Please complete the following questions. Thanks!</legend>
<Label> <b>Most likely to...</b></Label><br />
<label>1. Be on the price is right</label><br />
<select name="priceisright">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>2. Become a millionaire</label><br />
<select name="millionaire">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>3. Loose passport in Europe</label><br />
<select name="loosepassport">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>4. Live in a van by the river</label><br />
<select name="vanriver">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>5. Cheat on Spouse</label><br />
<select name="spusecheat">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>6. Marry for money</label><br />
<select name="marrymoney">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>7. have 5 divorces before 30</label><br />
<select name="5divorces">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>8. Be prime minister of Canada</label><br />
<select name="primeminister">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>9. Teach at ECI</label><br />
<select name="teacheci">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>10. Be a 40 year old virgin</label><br />
<select name="40yearoldvirgin">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>11. Live with their parents</label><br />
<select name="livewparents">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>12. Die holding their cell phone</label><br />
<select name="dieholdingcell">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>13. Have a damaged liver before 19</label><br />
<select name="damagedliver">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>14. End up in jail</label><br />
<select name="jail">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>15. Get plastic surgery on their whole body</label><br />
<select name="plasticsurgery">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>16. Adopt children from a 3rd world</label><br />
<select name="adoptchildren">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>17. Buy their friends</label><br />
<select name="buyfriends">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>18. Memorize the Dictionary</label><br />
<select name="Dictionary">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>19. Still be at ECI in 5 years</label><br />
<select name="eci5years">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>20. Become the true Guitar Hero</label><br />
<select name="guitarhero">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>21. Join a Convent</label><br />
<select name="convent">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>22. Dance to Soulja boy at their wedding</label><br />
<select name="souljaboywedding">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>23. Win the nobel peace prize</label><br />
<select name="nobelpeace">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>24. Be the biggest tree hugger/environmentally friendly</label><br />
<select name="huggerenvironment">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label><b>Biggest</b></label><br />
<label>25. Mack </label><br />
<select name="mack">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>26. Ego</label><br />
<select name="ego">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>27. Partier</label><br />
<select name="partier">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>28. Cougar</label><br />
<select name="cougar">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>29. Awkward</label><br />
<select name="awkward">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>30. Dramatic</label><br />
<select name="dramatic">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>31. Gossip</label><br />
<select name="gossip">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>32. Cluts</label><br />
<select name="cluts">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label><b> Best</b></label><br />
<label>33. Car</label><br />
<select name="car">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>34. Style</label><br />
<select name="style">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>35. Hair</label><br />
<select name="hair">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label> <b>------------------------------------------------------------</b></label><br />
<label>36. Cutest Couple</label><br />
<select name="cutestcouple">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>37. Hottest Parents</label><br />
<select name="hottestparents">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>38. Playboy/Playgirl</label><br />
<select name="playboygirl">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>39. Kingsway Mom & Dad</label><br />
<select name="kingswaymd">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>40. Funniest</label><br />
<select name="funniest">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<label>41. Most athletic</label><br />
<select name="athletic">
<option value="">Please Choose One Person</option>
<option value="">Not Voting</option>
<?php echo $option; ?>
</select>
<br />
<input name="submit" value="submit" type="submit">
</form>
</body>
</html>