Posts Tagged ‘A’

Beginner PHP Tutorial – 105 – Reading a Simple XML File Part 1

HTML PHP Tutorial – Building a working Contact Form Part 3.flv

Beginner PHP Tutorial 123 Creating a Database Hit Counter Part 1 ‏

A Different Background Color Depending On The Radio Button Selected?

I need a little help… Please…
I am working on a script but I can’t get one part…

<?php
$Fname = $_POST['Fname'];
$Lname = $_POST['Lname'];
$gender = $_POST['gender'];
$major = $_POST['major'];
$activities = $_POST['activities'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$bgcolor = "";
If ($_POST['gender'] == 'male') {
$bgcolor == "Blue";
} elseif($_POST['gender'] == 'female') {
$bgcolor == "Pink";
}
{
echo "$Fname $Lname,

“;
echo “Thank you for completing the survey we have noted that you are are a student majoring in $major who is active in the following clubs:

“;
foreach ($activities as $a) {
echo “

  • $a


  • “;
    }
    echo “Your comments $comments have been fowarded to the appropriate person. They may reply to your email address $email”;
    }
    ?>
    I need the table in the middle to change colors depending on the gender that is selected.
    Can any one help me figure this out… I have tried everything
    Vickie S.

    Need A Php Expert For Some Theory Help! I Do Not Want Explicit Code, Just Some Ideas On How To Go About It.?

    Here is what I have so far. I populate a table dynamically from my database and include check boxes. I need to be able to modify the text fields, then have only the checked rows updated in my db. I am stuck on how to determine which boxes are checked, and then how to post the correct rows to my modify script. I can modify with sql and delete with sql, just do not know how to transfer the data from an html table by checked rows to my other page. Any help would be greatly appreciated. Here is my code. I am not loooking for specific code examples, that would be cheating. I just need to know if what I am doing is possible and some ideas on where to go with it. NOTE: I commented out the session so it will not affect someone trying to view the table.


    <?php
    // Starting my session
    // session_start();
    // if (isset($_SESSION['user'])) {
    //
    // $msg= "You are logged in as $_SESSION[user]";
    // }
    // else {
    // header("Location: login.html");
    // }
    // Variable for output
    $displayBlock = "";
    // Variables for db name, connection, and table name
    $db_name= "student_surveydb";
    $mainTable= "survey_table";
    $connection= mysql_connect("localhost", "root", "")
    or die(mysql_error());
    // Defining bgcolor variable
    $bgcolor= 'beige';
    // connecting to db
    $db= mysql_select_db($db_name, $connection) or die(mysql_error());
    // Assigning select statement to variable.
    $sql= "SELECT * FROM $mainTable ORDER BY studentID";
    // Assigning result
    $result= mysql_query($sql, $connection) or die(mysql_error());
    $idarray = array("0");
    $firstArray= array("first name");
    $lastArray= array("last name");
    $genArray= array("gender");
    $majArray= array("major");
    $comArray= array("comments");
    $emailArray= array("email");
    // While loop to loop through array of results, assigning values as it goes.
    while ($row = mysql_fetch_array($result)) {
    $id= $row['studentID'];
    array_push($idarray, "$id");
    $firstName= $row['studentFirst'];
    array_push($firstArray, "$firstName");
    $lastName= $row['studentLast'];
    array_push($lastArray, "$lastName");
    $gender= $row['gender'];
    array_push($genArray, "$gender");
    $major= $row['major'];
    array_push($majArray, "$major");
    $comments= $row['comments'];
    array_push($comArray, "$comments");
    $email= $row['email'];
    array_push($emailArray, "$email");
    $fullName= "$firstName $lastName";
    $num= 1;
    // Assigning output as table.
    $displayBlock .= "

    $id <INPUT TYPE= \"text\" SIZE= \"6\" NAME= \"gender\" VALUE= '$gender' <INPUT TYPE= \"text\" SIZE= \"12\" NAME= \"major\" VALUE= '$major' <INPUT TYPE= \"text\" SIZE= \"22\" NAME= \"comments\" VALUE= '$comments' <INPUT TYPE= \"text\" SIZE= \"22\" NAME= \"email\" VALUE= '$email'

    “;
    $num++;
    }
    $num= 0;
    ?>

    <!–

    –>

    Modify ID Student First Student Last Gender Major Comments E-mail Address

    Return to Admin Page.


    </FORM

    How To Set Up A Mysql Database For A Php/java Poll?

    Hi, on my site I have a polls page where have a list of questions that are usually made from a radio group. I’m wanting to take the answers and use Javascript to forward the answer to a mySQL database using PHP. I went to: http://www.w3schools.com/php/php_ajax_da… which has a very nice explination of mySQL, but it didn’t really help much.
    I’m wanting to have a table that contains the answers and a value. I’m wanting to make that value go up one each time someone votes for that value on the polls page. Also, on a seperate page I have the current number of votes. How exactally would I do this?
    ex. What do you prefer?
    Radio1: Sweet
    Radio2: Sour
    After an answer is selected (let’s say sweet) the script adds 1 to the number of votes for that answer on the mySQL database. Then the person is redirected to the page that shows the total number of votes for both answers. (let’s say 40 people said sweet, and 42 said sour).
    Can anyone help me with this?

    Php Cannot Include A File Only When Accessing The Website With Ssl. Why?

    I can access my webpage using http or https. When I access using http (i.e., http://www.site.com/myscript.php ), the PHP script works fine. When I access using https (i.e., https://www.example.com/myscript.php ), PHP fails because it cannot access files that are include’d in the script. I’ve checked and the the include_path is the same. What’s wrong?

    Hi I Have A Php Script That I Need To Run Via Cron Daemon.?

    Hi I have a php script that I need to run via Cron Daemon. The script runs perfectly from the browser address bar but not as a Cron job.
    Here is the script:
    Code:
    get_var($SQLstmt);
    if($complete == 1){
    header(‘Location: http://www.mywebsite.com/sendreminder.ph…
    }
    ?>and this is the error I get via email:
    /hsphere/local/home/paulkili/buzzmesms… ?php: No such file or directory
    /hsphere/local/home/user/mywebsite.com… line 2: syntax error near unexpected token `mysql_connect(”
    /hsphere/local/home/user/mywebsite.com… line 2: `$connection = mysql_connect(‘mydatabase’,'Iamtheuser’,…
    What am I missing if it runs fine from the address bar why not via Cron Daemon. Pls help me I have now tried every thing I know.

    Need Help With A Php Script.?

    I know very little about PHP and was hoping I could find some help here. I have one piece of PHP built into my html that reads:

    It is supposed to control what happens when the following input bar is updated by the enter button etc.

    Which it does, however it doesn’t know what to do. Now I have a PHP document written by somebody else (his name is at the top of the script in a comment) that i want to use with the text input bar.

    My only problem is, is that I don’t know how to make the updater read the PHP file above. (which should act as a proxy)
    Any help is greatly appreciated, Thanks!