Login   Register  
PHP Classes

File: Requests/example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arkadiusz Malinski  >  Requests  >  Requests/example.php  >  Download  
File: Requests/example.php
Role: Example script
Content type: text/plain
Description: Exmple of using this class
Class: Requests
Validate HTTP request variable values
Author: By
Last change:
Date: 8 years ago
Size: 1,705 bytes


Class file image Download
<title>example page</title>
include 'class.requests.php';

  try {
$requests = new Requests();
$requests->dataExist(METHOD_POST)) {
// modyfying conditions values

// adding conditions to fieldname

// test all definied conditions; on failure throws an exception;
// it's seems to be ok an we can insert data into database
$sql "insert into testTable(name,email) VALUES('".
$requests->getPost("name")."', '".$requests->getPost("email").
"') WHERE id = ".$request->getPost("id");

$DB NewADOConnection('mysql');
$result $DB->Execute($sql);
    } else {
            <form action="example.php" method="POST">
            <input type="hidden" name="id" value="233">
            <input type="text" name="name" value=""><br>
            <input type="text" name="email" value=""><br>
            <input type="submit" value="Send">
  } catch (
RequestsException $re) {
"Error in sending data. Please return to form an fill it with corrent values";
  } catch (
Exception $error) {
"Error: ".$error->getMessage();