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

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...
The code to create a Search/Filter Data with Javascript or html from html page.
The code to create a Search/Filter Data with Javascript or html from html page.
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...
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.
write php code for buying and selling web using sql, javascript ,html ,css style
write php code for buying and selling web using sql, javascript ,html ,css style
Create a form using the following HTML elements at a minimum. Style the form in your...
Create a form using the following HTML elements at a minimum. Style the form in your CSS. You do not need to include a form action (i.e. the form doesn't have to do anything - we're designing the front end of the form). textarea textbox input type of "email" select radio button checkbox submit button style at least three elements of your form in your stylesheet, including your submit button Use a comment to delineate the beginning and end of...
With PHP Create a class called Account that a bank might use to represent customers' bank...
With PHP Create a class called Account that a bank might use to represent customers' bank accounts. Your class should include one data member of type int to represent the account balance. Your class should provide a constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0. If not, the balance should be set to 0 and the...
specify the code to create html with the following content: 1. a paragraph stating, this is...
specify the code to create html with the following content: 1. a paragraph stating, this is an example. 2 image logo.jpg with alternate text ABC Logo below the paragraph created in 1.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT