Wow! Haven't gotten a reply. Anyway, I still need some assistance with this PHP code. On 8/3/11, Jacob Kruger <jacobk@xxxxxxxxxxxxxx> wrote: > Ok, will try have a look at it a bit later, and let you know, but, FWIW, I > only sort of play around in PHP currently, but anyway. > > Stay well > > Jacob Kruger > Blind Biker > Skype: BlindZA > '...fate had broken his body, but not his spirit...' > > ----- Original Message ----- > From: "Edgar Lozano" <1419goku@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Wednesday, August 03, 2011 6:01 PM > Subject: Re: PHP Code > > >>I don't get any errors yet. But what I'm asking, is if anyone could >> direct me in the right path to complete this little voting page. >> That's all. >> Thanks >> >> On 8/3/11, jacobk@xxxxxxxxxxxxxx <jacobk@xxxxxxxxxxxxxx> wrote: >>> Ok, what is the actual error you get when you try use these pages then? >>> >>> Stay well >>> >>> Jacob Kruger >>> Blind Biker >>> Skype: BlindZA >>> '...fate had broken his body, but not his spirit...' >>> On Tue, 2 Aug 2011 16:18:07 -0500, Edgar Lozano <1419goku@xxxxxxxxx> >>> wrote: >>>> I'm sorry. The config.php file is config.inc. It works the same for >>>> me. Anyway, thanks for pointing that out! >>>> >>>> On 8/2/11, Jacob Kruger <jacobk@xxxxxxxxxxxxxx> wrote: >>>>> Off hand, you said the first file is config.php, but in vote.php, >>>>> you're >>>>> telling it to include config.inc...? >>>>> >>>>> Stay well >>>>> >>>>> Jacob Kruger >>>>> Blind Biker >>>>> Skype: BlindZA >>>>> '...fate had broken his body, but not his spirit...' >>>>> >>>>> ----- Original Message ----- >>>>> From: "Edgar Lozano" <1419goku@xxxxxxxxx> >>>>> To: <programmingblind@xxxxxxxxxxxxx> >>>>> Sent: Tuesday, August 02, 2011 8:28 PM >>>>> Subject: PHP Code >>>>> >>>>> >>>>>> Hello all. >>>>>> Hope yall don't mind me throwing some PHP code out there. Could you >>>>>> please give me some suggestions? >>>>>> I'm trying to create a voting page for my website. The files are as >>>>>> follows: >>>>>> A config.php file >>>>>> An index.php file, >>>>>> An vote.php file >>>>>> And a voteprocessing.php file. >>>>>> The contents of the config.php file are as follows: >>>>>> <?php >>>>>> $host="localhost"; >>>>>> $user="user"; >>>>>> $pass="password"; >>>>>> $edgar=mysql_connect($host,$user,$pass); >>>>>> if(!$edgar) >>>>>> { >>>>>> die("Cannot connect properly. " . mysql_error()); >>>>>> } >>>>>> $db="database2"; >>>>>> $db2=mysql_select_db($db,$edgar); >>>>>> if(!$db2) >>>>>> { >>>>>> die("Error: cannot find Database. " . mysql_error()); >>>>>> } >>>>>> The contents of the Index.php file are as follows: >>>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >>>>>> "http://www.w3.org/TR/html4/loose.dtd";> >>>>>> <html lang="en-US"> >>>>>> <head> >>>>>> <title>Voting page</title> >>>>>> </head> >>>>>> <body> >>>>>> <div id="main"> >>>>>> <p> >>>>>> Hello. Welcome to my voting page. <br> >>>>>> On this page, you are allowed to vote on your favorite music!<br> >>>>>> Everyday, I have a song of the day, and I would like more interaction >>>>>> for that section.<br> >>>>>> I can't come up with any ideas of music that other people will like, >>>>>> so everyday, I will put options for you to vote on.<br> >>>>>> </p> >>>>>> <p> >>>>>> Rules<br><br> >>>>>> In order for you to vote, you will need to have an account on my >>>>>> Forum!<br> >>>>>> To log into my forum, >>>>>> <a href="http://edgar.ueuo.com/forum/login.php";>Click Here.</a><br> >>>>>> If you would like to register, to take advantage of all these cool >>>>>> things, you can register >>>>>> <a href="http://edgar.ueuo.com/forum/register.php";>Here.</a><br> >>>>>> Finally, if you want to vote, >>>>>> <a href="http://edgar.ueuo.com/music/vote.php";>Click Here.</a><br> >>>>>> Thank you for your interest, and participation in my website. >>>>>> </p> >>>>>> </div> >>>>>> © by Edgar Lozano<br> >>>>>> All Rights Reserved >>>>>> </body> >>>>>> </html> >>>>>> The contents of the vote.php file are as follows: >>>>>> <?php >>>>>> include("config.inc"); >>>>>> $question = "What would you like the song of the day to be for >>>>>> tomorrow?"; >>>>>> $a1 = "A wrap song"; >>>>>> $a2 = "A Country Song"; >>>>>> $a3 = "Another genre"; >>>>>> $a4 = "Random song"; >>>>>> $a5 = "I cannot decide give me more options"; >>>>>> $insert = "INSERT INTO Polls >>>>>> VALUES('', '$question', '$a1', '$a2', '$a3', '$a4', '$a5')"; >>>>>> if(!mysql_query($insert)) >>>>>> { >>>>>> die("Error: " . mysql_error()); >>>>>> } >>>>>> ?> >>>>>> <html> >>>>>> <head> >>>>>> <title>Song of The Day Voting Page</title> >>>>>> </head> >>>>>> <body> >>>>>> <p>To vote, just select your option, and click on the submit >>> button.</p> >>>>>> <?php >>>>>> echo $question . "<br>"; >>>>>> ?> >>>>>> <form action="voteprocessing.php" method="post"> >>>>>> <?php echo $a1 . "<br>"; ?> <input type="radio" name="answer1"/> >>>>>> <?php echo $a2 . "<br>"; ?> <input type="radio" name="answer2"/> >>>>>> <?php echo $a3 . "<br>"; ?> <input type="radio" name="answer3"/> >>>>>> <?php echo $a4 . "<br>"; ?> <input type="radio" name="answer4"/> >>>>>> <?php echo $a5 . "<br>"; ?> <input type="radio" name="answer5"/> >>>>>> <input type="submit" name="submit" value="vote"/> >>>>>> </form> >>>>>> </body> >>>>>> </html> >>>>>> And finally, the contents of the voteprocessing.php file are as >>> follows: >>>>>> <?php >>>>>> include("config.inc"); >>>>>> echo "Thanks for voting."; >>>>>> echo "The results are as follows!"; >>>>>> $answer1 = $_post['answer1']; >>>>>> $answer2 = $_post['answer2']; >>>>>> $answer3 = $_post['answer3']; >>>>>> $answer4 = $_post['answer4']; >>>>>> $answer5 = $_post['answer5']; >>>>>> $submit = $_post['submit']; >>>>>> $sql = mysql_query("insert into pollAnswers >>>>>> (pk_id, pollID, answer, visitorIP) >>>>>> values('', '', '$submit', '')"); >>>>>> if(!$sql) >>>>>> { >>>>>> die("error: " . mysql_error()); >>>>>> } >>>>>> ?> >>>>>> As you can see, I have already created two tables. pollAnswers and >>>>>> polls. I want Polls to contain the poll question and the five answers >>>>>> to that question. I want the PollAnswers table to contain the pollID >>>>>> and pk_id with the visitors IP address and the answer that they chose. >>>>>> Can someone direct me in the right path to how to construct the rest >>>>>> of this voteprocessing.php file? >>>>>> I would greatly appreciate it! >>>>>> __________ >>>>>> View the list's information and change your settings at >>>>>> //www.freelists.org/list/programmingblind >>>>>> >>>>> >>>>> __________ >>>>> View the list's information and change your settings at >>>>> //www.freelists.org/list/programmingblind >>>>> >>>>> >>>> __________ >>>> View the list's information and change your settings at >>>> //www.freelists.org/list/programmingblind >>> __________ >>> View the list's information and change your settings at >>> //www.freelists.org/list/programmingblind >>> >>> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind