When we need some information from user then we create a form. It is a necessary part of website. I will show you how you can create form in HTML and Temp File
HTML Form:-
<h2>Serial Number Inquiry</h2>
<div>
<form id="form8" action="order-track.html"><br />
<input id="trackid" name="trackid" type="text"><br />
<input type="submit" value="Track"><br />
</form>
</div>
Temp File Form:-
<h2 id="heading1" runat="server">Serial Number Inquiry</h2>
<div>
<form id="form8" runat="server" action="order-track.html"><br />
<input id="trackid" runat="server" type="text"><br />
<input type="submit" value="Track"><br />
</form>
</div>
There are not any big difference in both forms only Temp File provide us extended features. We can use component in Temp File. Components provide us rich GUI and it hides all difficult and complex code from Temp File. Like in above code we are using a form and a textbox component. How we can use component in TempFile we will discuss it in next topic.
How you can Handle form on server side:-
First create an application in apps folder. Register your app with in reg.php file with followed code
registerApp('order',"apps/order.app");
How you can Handle TempFile form on server side:-
Write code in your application to handle the TempFile form
class index extends \Sphp\tools\BasicApp{
private $temp1 = null;
public function onstart(){
// create TempFile Object
$this->temp1 = new TempFile($this->mypath . "/forms/order_front.front");
}
public function page_new(){
// write class attribute of HTML tag h2 in temp file
$this->temp1->heading1->class = "alert";
}
public function page_event_track($evtp){
print "your form is submitted. Your orderID is " . $this->temp1->trackid->value;
}
}