Help with creating static website from a form using PHP

pasenseoso

Power Member
Joined
Aug 19, 2011
Messages
765
Reaction score
141
Hi Guys..

I need help to create a static page out from a reservation page for a real estate website project.

I wanted to "save" a particular page after the user submits the form but isn't visible to them but they will be redirected somewhere. So the scenario is as follows :

user is in the reservation page where he/she inputs details then clicks "submit" -> the form with its entries will be saved in a .txt file (invisible to user) -> user is redirected to a thank you page.

The saved .txt file in a specific directory will then serve as a transaction receipt between the client and agent. The file can then be "downloaded" via the sales agent's and the sales manager email every time a transaction is made online.

I wanted to have this type of scheme so property agents will not steal each others' clients because they are fighting over claiming the clients (and commissions) as of with our current system.


Hope to get some great suggestions with you guys...
 
This is possible with PHP. Not too complex.
just curious, why do you want to save it in txt file and not in a DB.
you can extract from DB and display it to the client.
 
Because I want it to serve as a receipt so sales agents can print it out and show it to the office for documentation. Because the company has a policy that a client signed under their name will expire in just thirty days. Plus the company manager has no idea about database things and he told me that it can easily be "gamed". So printing out the transaction receipt is the best choice.

So how can I accomplish this?
 
Depends where you are sending data, what are you sending and how (POST/GET), but I suppose that to form.php, sending client name only over GET method:

Code:
<?php

//GET VALUE from <input type="text" name="client_name"/> SEND OVER GET METHOD
$client_name = $_GET['client_name']

//OPEN FILE NAMED saveToThis.txt
$fileToSave = fopen('saveToThis.txt','w');

//WRITE TO FILE LINE WITH CLIENT NAME
fwrite($fileToSave, "Client name: " . $client_name); 

//CLOSE FILE
fclose($fileToSave);

//AFTER SAVE YOU WILL REDIRECT TO THANK YOU PAGE
header('Location: thank-you-page.html');

?>

It is not full script, but should give you good starting point ... btw, I created it directly from head, so not tested ... but it should works ;)
 
PHP can solve your problems but developing a full fledged form will take more details..
Also, using database is still better option.
 
Thanks guys...

Yeah It should also be stored in the database and also a text file for receipt. It is done this way so that sales agents will have proof who closed the deal first for a common client. thanks guys... I'm working on it now.. :-)
 
Back
Top