How to connect a php voting script together

hey guys so I have two scripts. One script is the action vote script which when pressed takes all the information from the song. The second script is supposed to take that information and read it and do a query based on the information. Im having trouble connecting these two scripts together.

The first script is

if($_REQUEST['action']=="vote"){
// NOTE: Some PHP installations may use a different nomenclature for the "$_REQUEST" such as "$_HTTP_SERVER"
$theContent = "";

// Here we are extracting all of the info contained in the request.
for ($i=0; $i<count($_REQUEST['value']);$i++){
$theContent = urldecode($_REQUEST['value'][$i]);
}

Please use the code snippet feature when you post code here at EE. It makes it easier to read and copy, and it gives us line numbers that facilitate conversation.

From the look of that code snippet, I am going to guess that you did not write it yourself. But in any case, I think you might benefit from getting some foundation in how PHP and MySQL work together. This book can help with that.http://www.sitepoint.com/books/phpmysql4/

I will try to cobble together a sample script that shows how to keep counts of votes. It seems to be a fairly common question and one that is not well understood.

Step one - create two tables. The EE_vote_colors table is the subject of our survey. The EE_vote_votes table is where we record the votes. By keeping a separate table for the votes we are creating a log of all votes that will enable us to answer questions related to trending topics, geographical location of our voters (tied to IP address), etc. We could probably keep a great deal more interesting information in this table if we had, for example, a requirement for voters to be registered and logged in.

After initialization, the first thing we do comes at line 40, where we get an array of the colors. Starting on line 52 we test to see if any votes have been cast. If so we get the client IP address and we use the iterator on line 55 to retrieve each of the votes for the colors. We insert one row into the "votes" table for each vote cast.

Next we show the statistics for all the colors. The iterator on line 69 runs a set of queries. We display one line for each color, staring on line 77.

Our action script processing is complete at line 92. The only thing that remains is to produce the form, and that happens on lines 94 through the end of the script.

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …

In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property
Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

The viewer will learn the basics of jQuery including how to code hide show and toggles.
Reference your jQuery libraries:
(CODE)
Include your new external js/jQuery file:
(CODE)
Write your first lines of code to setup your site for jQuery…