User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,635 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,405 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2026 | Replies: 62 | Solved
Reply
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,045
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: survey for school grads... Another question

  #21  
Jan 16th, 2008
comment out mail(...) line in your script and on top of the script, right after <?php put this line. print_r($_POST); Then fill out the form once again, click on submit. Check If any value assigned to ['style'].
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 59
Reputation: dani190 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: survey for school grads... Another question

  #22  
Jan 16th, 2008
ok checked. Absolutely nothing is being assigned. I tried it on a bunch of other ones also. Nothing changes with the post message at the top...
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,045
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: survey for school grads... Another question

  #23  
Jan 16th, 2008
Well, you need to post your script then.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 59
Reputation: dani190 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: survey for school grads... Another question

  #24  
Jan 16th, 2008
<?php
print_r($_POST);
$conn=mysql_connect("***********.anblickstudios.com","************","*******"); 
mysql_select_db("gradsurvey");
$query="select user_id from grads";
$result=mysql_query($query);
$option="";
while($row=mysql_fetch_array($result)) {
   $option.="<option value=".$row['grads'].">".$row['user_id']."</option>";    
}
if(isset($_POST['submit'])) {
$query="UPDATE TABLE SET VOTE_STATUS = 1 WHERE USER_ID ='".$_POST['grads']."'";	
mysql_query($query);
}
?>
<!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>';


?>



<?php
// Mail Script
if(isset($_POST['submit'])){
$selection=$_POST['style'];
$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'];
$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 = "Price is right: $a";
mail("email@anblickstudios.com","Grad Survey 08",$message,"from: email@anblickstudios.com");
}

// Mail Script
if(isset($_POST['submit'])){
$selection=$_POST['style'];
$message = "Thank you for registering with our site!\nYour selection was $selection.\n\nSincerely,\nUs";
mail("****@anblickstudios.com","Grad Survey 08",$message,"from: *****@anblickstudios.com");
}
?>

<form 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>
Last edited by dani190 : Jan 16th, 2008 at 11:26 pm. Reason: Had to add the variables back in sorry
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,045
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: survey for school grads... Another question

  #25  
Jan 16th, 2008
Weird. This script is running fine on my system. Print out the message! I get,
Thank you for registering with our site! Your selection was naveen2. Sincerely, Us
. Also check if you are populating the dropdown list! Or, I think you probably selected either "Please Choose One Person" or "Not Voting". Assign some value to these options and test.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 59
Reputation: dani190 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: survey for school grads... Another question

  #26  
Jan 17th, 2008
ok but how do i check? When i click the drop down menu i see all the names. That all works...
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,045
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: survey for school grads... Another question

  #27  
Jan 17th, 2008
huh! Right click on your page and click on view source. Check if the value for <option value=''> is being set. Check if its not null. Then select some dropdown list values and check again. When you submit, if you get something like, array([priceisright]=>your choice,......) , then your code has no problem!
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 59
Reputation: dani190 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: survey for school grads... Another question

  #28  
Jan 17th, 2008
well if you mean this
<option value=>Jacob Anderson</option><option value=>Mohammed Abbas</option><option value=>Hiroaki Abe</option>

Yes they are being populated properly. I tried selecting but nothing. So maybe something is wrong with the script?
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,045
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: survey for school grads... Another question

  #29  
Jan 17th, 2008
See! I told you. Values are not being assigned to the option ! This should have been,
  1. <option value=Jacob Anderson>Jacob Anderson</option><option value=Mohammed Abbas>Mohammed Abbas</option><option value=Hiroaki Abe>Hiroaki Abe</option>




Edit: Change
$query="select user_id from grads";
to
$query="select user_id,grads from grads";

It should work.
Last edited by nav33n : Jan 17th, 2008 at 7:26 pm.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Dec 2007
Posts: 59
Reputation: dani190 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
dani190 dani190 is offline Offline
Junior Poster in Training

Re: survey for school grads... Another question

  #30  
Jan 17th, 2008
so hows that fixed? thats straight from the database? Its not importing correctly possibly


FIXED!

I hope... 1 second
Last edited by dani190 : Jan 17th, 2008 at 7:29 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 10:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC