Question

In: Computer Science

- Create an html form (bank form) and the PHP code with 2 accounts with options...

- Create an html form (bank form) and the PHP code with 2 accounts with options to transfer, deposit or withdraw money.

Solutions

Expert Solution

<?php

Class Account{

Private $name;

Private $number;

Private $balannce;

Public function get_name()

{

Return $this->name;

}

Public function get_number()

{

Return $this->number;

}

Function_construct($name, $number)

{

$this->name=$name;

$this->number=$number;

$this->balance=0;

}

Public function deposit($amount)

{

$this->balance=$this->balance+$amount;

}

Public function withdraw($amount)

{

If($this->balance-$amount>=0)

$this->balance=$this->balance-$amount;

Return “withdrawn”;

}

Else

{

Return ‘Insufficient balance’;

}

}

<html>

<head>

<meta charset=”UTF-8”>

<title></title>

</head>

<body>

<form>

Customer Name:<input type=’text’ name=çustomerNameText’><br/>

Account No :<input type=’text’ name=AccountNameText’><br/>

<input type=’Submit ’ Iname=’CreateButton’    value=”Create”><br/>

Amount :<input type=’text’ name=’amounttext’><br/>

<input type=’submit’ name=’depositButton’   value=”Deposite” ><br/>

<input type=’submit’ name=’WithdrawButton’   value=”Withdraw” ><br/>

<input type=’submit’ name=’showreportButton’   value=”Showreport” ><br/>

</form>

<?php>

Require _once ‘Account.php’;

Session_start();

If(isset($_GET[‘ ’CreateButton’    ]))

{

$account=new Account(($_GET[‘ ’CustomerNameText’ ], ($_GET[‘AccountNo’ ] ))

Session_start();

$_SESSION[“an_account’]=$account;

Echo “AccountCreated”;

}

If(isset($_GET[‘ ’DepositButton’    ]))

{

$account=$_SESSION(‘an account’[;

$account->deposite($_GET[‘amountText’]);

$_SESSION[‘an account’]=$account;

}

If(isset($_GET[‘ ’WithdrawButton’    ]))

{

$account=$_SESSION(‘an account’[;

Echo $account->Withdraw($_GET[‘amountText’]);

$_SESSION[‘an account’]=$account;

}

If(isset($_GET[‘ ’ShowReportButton’    ]))

{

$account=$_SESSION(‘an account’[;

Echo $account->get_name().’<br/>;

Echo $account->get_number().’<br/>;

Echo $account->get_balance().’<br/>;

}

}

}


Related Solutions

Utilizing PHP and HTML code Create a form that has text inputs for two numbers and...
Utilizing PHP and HTML code Create a form that has text inputs for two numbers and a submit button. Submit the values to a program that calculates and displays the GCD of the two numbers. The greatest common divisor of two integers a and b is the largest integer that is a factor of both a and b. The GCD of any number and 1 is 1, and the GCD of any number and 0 is that number. For example:...
Please create a PHP action codes for the HTML CODE provided below. <!DOCTYPE html> <html> <head>...
Please create a PHP action codes for the HTML CODE provided below. <!DOCTYPE html> <html> <head> <title> Project for keeping all your input </title> </head> <body> <h1>Welcome to this Web Based Test!!!</h1> <p>Please answer the following questions:</p> <hr/> <form action="" method="post"> Name: <input type="text" name="name" value=""> <font color=red>*</font><br/><br/> E-mail: <input type="text" name="email" value=""> <font color=red>*</font><br> <hr/> Choose your major area of study: <select name="major"> <option value="Digital Media" >Digital Media</option> <option value="Software" >Software</option> <option value="Security" >Security</option> <option value="Business" >Business</option> <option value="Other"...
Use PHP, javascript and a little bit of Html More focus on php Create a logout...
Use PHP, javascript and a little bit of Html More focus on php Create a logout page (for patients) in hotel management. Please provide the screenshot of the output too (logout page). Hint: the logout page should include like this thanks for visting etcetera. Thanks in advance
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
Write a PHP program using HTML form. It will take Length, Width and Height of a...
Write a PHP program using HTML form. It will take Length, Width and Height of a box as input. When a button is pressed, it will calculate the Volume. If Volume is less than 25 then display the message “Small box”. If Volume is from 25 to 50, it will display the message “Medium box”. When the Volume is greater than 50, then display the message “Large box”.
1. Create a PHP page with standard HTML tags. Remember to save the file with the...
1. Create a PHP page with standard HTML tags. Remember to save the file with the .php extension. Inside the <body> tag, create a PHP section that will show the text "Hello World!" 2. For this exercise, echo the phrase "Twinkle, Twinkle little star." Create two variables, one for the word "Twinkle" and one for the word "star". Echo the statement tothe browser. 3. PHP includes all the standard arithmetic operators. For this PHP exercise, you will use them along...
Using PHP, Create a form that uses the method POST to send the information. The form...
Using PHP, Create a form that uses the method POST to send the information. The form should capture the distance the package needs to travel with the one field for the distance in miles. All fields should have the REQUIRED attribute. The form should have a submit button and reset button. The form should look nice. All the labels should line up horizontally and all the INPUTS/SELECT should line up horizontally.
I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to...
I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to retrieve the information from the database on to my localhost. Please post a php/html code that will create a search page and return the data from my phpmyadmin database. The 3 items I have on the database are first_name, last_name and birth_day.
Create a web page using PHP and HTML that contains a list of movie names available...
Create a web page using PHP and HTML that contains a list of movie names available for rent (at least 10 movies), so that each time you visit the home page, you see a different order of movies in the list. The movie names are required. 2) The rental price for each movie ranges between $1.99 to $7.99. • Create an associative array with a code for the movie as the key (e.g., movie1, movie2, etc.) and the associated rental...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT