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

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"...
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”.
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.
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.
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
Please code the arrays. This is in PHP/HTML Perform some calculations: 1. $ages = [24, 12,...
Please code the arrays. This is in PHP/HTML Perform some calculations: 1. $ages = [24, 12, 10, 17, 23, 29, 35, 32, 30, 22] Using a FOR loop, calculate the sum and average of these numbers, then print them. Please provide legible output. 2. If I change the array to $ages = [1 => 24, 12, 10, 17, 23, 29, 35, 32, 30, 22] How will the program change? Re-run the program and provide output 3. Assume that the above...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT