Jump to content

xaznbabyx

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by xaznbabyx

  1. My teacher only says he wants user to enter a number for the size of the table and keep the the size is between 1 and 10, inclusive. It is not working and I don't get how to enter the number for the size, I think I am missing something? Im am not sure if what I am doing is correctly. http://hills.ccsf.edu/~schow11/cs130a/hw4.php <?php $cols = 11; $rows = 11; print '<table border="1">'; for ($n = 1; $n < $rows; $n++){ print '</tr>'; for ($i = 1; $i < $cols; $i++) print '<td>' .$i*$n. '</td>'; print '</tr>'; } print "</table>" ?> Create a set of PHP pages that allows the user to create a square multiplication table. The first page should contain one text box that asks the user the size of the multiplication table. Note, there should only one text box. Not two text boxes (one for the rows and one for the columns). The second page displays the multiplication table, which must include the numbers being multiplied and the answers. For example, your multiplication table could look like this: http://imgur.com/jyJnKBg In addition to creating the multiplication table, you page should: Ensure that the user enters a number for the size of the table. Ensure that the size is between 1 and 10, inclusive.
  2. http://hills.ccsf.edu/~schow11/cs130a/hw3.php i did somethign like this but the error isn't displaying.. also how do u place in the php format with the indentations? <?php //check if form submitted if (isset($_POST['submit'])) { //if below statements are true will overwrite the variable //check if textcolor is set if (isset($_POST['textcolor'])) { $textcolor = $_POST['textcolor']; print "<p>The text color you chose is $textcolor color</p>"; } //check if bgcolor is set if (isset($_POST['bgcolor'])) { $bgcolor = $_POST['bgcolor']; print "<p>The background color you chose is $bgcolor color"; } else { if($background_color == $text_color) print '<p class="error">Please do not choose the text and background color!"</p>'; } } ?>
  3. i got it to change colors now I have to create an error and display the error message if they choose a color like black text and blue background etc. How would i create the error handling? http://hills.ccsf.edu/~schow11/cs130a/hw3.php Part IIn this part you will create a set of pages that could be used to test different text and background color combinations. Your first page should contain a form with two selection lists: one for the background color, and one for the text color. Your second page should process this form, displaying some sample text in the desired color with the desired background color. In addition, your program should display an error message (in black text on a white background) if the user selects the same color for both text and background. The specific colors you have in your selection lists are up to you, but you should have at least five colors in each list.
  4. http://pastebin.com/NB3eA3gn sorry about that if (empty($_POST) === false) { $username = $_POST['username'] $password = $_POST['password'] if (empty($username) === true | | empty($password) === true) { $errors[] = 'You need to enter a username and password'; } else if (user_exists($username) === false) { $errors[] 'Your username is incorrect.'; } else if (user_active($username) === false) { $errors[] = 'You have not activated your account!'; } else { if (strlen)($password)) > 20) { $error[] 'Username is too long'; } $login = login($username, $password); if login ==== false) { $errors[] = "That username or password is incorrect. Please try again."; } else if { $_Session['user_id'] = $login; header('Location: index.php'); edit(); } } ?>
  5. i copied and paste your code to see if it will work but im getting this error Notice: Undefined variable: textcolor in /students/schow11/public_html/cs130a/hw3.php on line 57'' http://hills.ccsf.edu/~schow11/cs130a/hw3.html
  6. http://hills.ccsf.edu/~schow11/cs130a/groupAssignmentClass.html i did something like this as I was looking through a tutorial on youtube. BUt its no really working and its confusing.
  7. Thank for your help. I had it working except it won't print the text color's color but instead it printed out the bg color on both statememts Now since I was figuring things out, I caused a error that I don't get. ' Notice: Undefined variable: textcolor in /students/schow11/public_html/cs130a/hw3.php on line 57 http://hills.ccsf.edu/~schow11/cs130a/hw3.html <?php if (isset($_POST['submit'])) { //check each if each post is set and it's value is data expect } if(isset($_POST['background']) && trim($_POST['background']) !=''){ $background = $_POST['background']; } else { $background = "#FFFFFF"; } function pmt($textcolor, $bgcolor){ } if (isset($_POST['red'])) { $textcolor = $_POST['red']; } if (isset($_POST['green'])) { $textcolor = $_POST['green']; } if (isset($_POST['blue'])) { $textcolor = $_POST['blue']; } if (isset($_POST['orange'])) { $textcolor = $_POST['orange']; } if (isset($_POST['yellow'])) { $textcolor = $_POST['yellow']; } if (isset($_POST['red'])) { $bgcolor = $_POST['red']; } if (isset($_POST['green'])) { $bgcolor = $_POST['green']; } if (isset($_POST['blue'])) { $bgcolor = $_POST['blue']; } if (isset($_POST['orange'])) { $bgcolor = $_POST['orange']; } if (isset($_POST['yellow'])) { $bgcolor = $_POST['yellow']; } print "<p>The text color you chose is $textcolor color"; print "<p>The background color you chose is $bgcolor color"; } ?>
  8. For this assignment, you are to create one set of PHP pages. The set will contain a page with a form, and a page that processes the data in this form. In this part you will create a set of pages that could be used to test different text and background color combinations. Your first page should contain a form with two selection lists: one for the background color, and one for the text color. Your second page should process this form, displaying some sample text in the desired color with the desired background color. In addition, your program should display an error message (in black text on a white background) if the user selects the same color for both text and background. The specific colors you have in your selection lists are up to you, but you should have at least five colors in each list. http://hills.ccsf.edu/~schow11/cs130a/hw3test.html Notice: Undefined index: textcolor in /students/schow11/public_html/cs130a/hw3.php on line 24 someone told me to use this format <style type='text/css'> .... body { background-color: red; } .... </style Then use class='bgcolor' in the opening tag of any element you want to apply that to <span class='bgcolor'> .... to just color some words in a paragraph
  9. before I had it like this but i kept getting undefined variable. The I used if (!isset ($_POST['loan'])) and it worked. <?php $loan = $_POST['loan']; $interest = $_POST['interest']; $months = $_POST['months']; $amount = $_POST['amount']; function pmt($loan, $interest, $months) { $loan = $loans; $months = $months; $interest = $interest/12; $amount = $loan * $interest/12 * pow((1 + $interest/12), $months) / (pow((1 + $interest/12), $months - 1)); return $amount; } ?>
  10. Someone told me to place if (!isset ($_POST['loan'])) and it works. But now my submit button isn't working. When I calculate the form it gives me this. http://hills.ccsf.ed...cs130a/hw2.html http://hills.ccsf.ed.../cs130a/hw2.php
  11. It works now! Thank you, you guys! Someone told me to place if (!isset ($_POST['loan'])) and it works. But now my submit button isn't working. When I calculate the form it gives me this. http://hills.ccsf.edu/~schow11/cs130a/hw2.html http://hills.ccsf.edu/~schow11/cs130a/hw2.php Notice: Undefined variable: loan in /students/schow11/public_html/cs130a/hw2.php on line 28 Your monthly car payment will be;0 a month, for 60months <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Homework 2</title> </head> <body> <pre> <p>Fill out this form to calculate monthly car payment</p> <form method="post" action="hw2.php" > <p>Loan Amount: <input type="text" name="loan" size="5" /></p> <p>Interest Rate: <input type="text" name="interest" size="5" /></p> <p>Number of Month: <input type="text" name="months" size="5" /></p> <p><input type="submit" value="Calculate"></p> </form> <?php if (!isset ($_POST['loan'])) // Get the values from $_POST $loan = 18000; $interest = 0.049; $months = 60; $amount = 338.86; function pmt($loan, $interest, $months) { $amount = $loan * $interest/12 * pow((1 + $interest/12), $months) / (pow((1 + $interest/12), $months - 1)); return $amount; } $amount = pmt($loan, $interest, $months); print "Your monthly car payment will be;" . round($amount,2) . " a month, for " . $months . "months"; ?>
  12. I don't get what am I suppose to do to get rid of the unidentified index? // Get the values from $_POST $loan = $_POST["loan"]; $interest = $_POST["interest"]; $months = $_POST["months"]; Notice: Undefined index: interest in /students/schow11/public_html/cs130a/hw2.php on line 13 Notice: Undefined index: months in /students/schow11/public_html/cs130a/hw2.php on line 14 Notice: Undefined variable: loan in /students/schow11/public_html/cs130a/hw2.php on line 24 Your monthly car payment will be;0 a month, for months
  13. Thank you so much. I found out what I was missing and im getting this error Notice: Undefined index: loan in /students/schow11/public_html/cs130a/hw2.php on line 4 Notice: Undefined index: interest in /students/schow11/public_html/cs130a/hw2.php on line 5 Notice: Undefined index: months in /students/schow11/public_html/cs130a/hw2.php on line 6 Warning: Division by zero in /students/schow11/public_html/cs130a/hw2.php on line 13 Your monthly carpayment will be;0 a month, for months <?php // Get the values from $_POST $loan = $_POST["loan"]; $interest = $P_POST["interest"]; $months = $_POST["months"]; and warning for this $amount = $loan * $interest * pow((1 + $interest), $months) / (1 - pow((1 + $interest), $months));
  14. anyways thank you that fixed the parse error. Im getting another error for echo Parse error: syntax error, unexpected 'echo' (T_ECHO) in /students/schow11/public_html/cs130a/hw2.php on line 17
  15. my teacher wants us to use the pow Assignment 2For this assignment, you are going to write a form that will allow someone to calculate their monthly payment for a car loan. Consider the following: The first page should contain a form with three text boxes, to allow the student to enter the following values:Total amount of loan Interest Rate Number of months The second page should calculate the monthly payment according to the following formula: For example, for a loan amount of $18000, an interest rate of 4.9%, and 60 months, the payment should be $338.86 Your second PHP page will need to use the built-in function pow(). The Rate used in the formula above should be the interest rate expressed as a decimal (i.e., 0.049, not 4.9) A person filling in the form can be expected to just enter numbers in the text boxes, no symbols (i.e., no $ or %). Do not worry about error checking for this. Consider using the printf function or the round function to format your payment amount to two decimal places.
  16. Im getting a parse error Parse error: syntax error, unexpected ')' in /students/schow11/public_html/cs130a/hw2.php on line 13 How do i calculate this equation? <?php // Get the values from $_POST $loan = $_POST["loanamount"]; $interest = $_POST["interest"]; $months = $_POST["months"]; // Calculate the monthly payment function pmt ($interest, $months, $loan) { $months = $months; $interest = $interest / 12; error--->$amount = $loan * $interest * pow((1 + $interest), $months,) / (1 - pow((1 + $interest), $months)); } $amount = pmt ($interest, $loan, $months) echo "Your monthly carpayment will be;" . round($amount, 2 . " a month, for " . $months . "months"; ?> html <!DOCTYPE html> <html> <head> <title>Homework 3</title> </head> <body> <div> <p> Fill out this form to calculate monthly car payment</p> <form method="post" action="hw2test.php"></form> <p>Loan Amount: <input type="text" name="loan" size="5" /></p> <p>Interest Rate: <input type="text" name="rate" size="5" /></p> <p>Number of Month: <input type="text" name="month" size="5" /></p> <input type="submit" name="submit" value="Caculate" /> </div> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.