Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input id="register-button" type="submit" name="register-firm" value="REGISTER">
- <?php
- //Testovani naplnenych poli
- $required = array('firm-name', 'ico', 'firm-email', 'web', 'street', 'house-number', 'city', 'psc');
- $error = false;
- foreach($required as $field) {
- if (empty($_POST[$field])) {
- $error = true;
- }
- }
- if ($error) {
- echo "<h4 id='error-msg'>Vyplňte všechna pole.</h4>";
- } else {
- //Zmacknuti register buttonu
- if (isset($_POST['register-firm'])) {
- //ziskani emailu
- $email = $_POST['firm-email'];
- //overeni spravneho tvaru
- if (filter_var($email,FILTER_VALIDATE_EMAIL) === false){
- echo "Spatne zadana forma emailu.";
- //overeni stejneho hesla
- } else {
- //pripojeni k databazi
- $oracle = new Oracle();
- $c = $oracle->connect();
- //ziskavani hodnot z formulaře
- $fname = $_POST['firm-name'];
- $ico = $_POST['ico'];
- $email = $_POST['firm-email'];
- $street = $_POST['street'];
- $housenumber = $_POST['house-number'];
- $city = $_POST['city'];
- $psc = $_POST['psc'];
- $state = $_POST['state-option'];
- $zapisFirmu = "BEGIN register_firm(:param1, :param2, :param3, :param4, :param5, :param6, :param7,:param8); END;";
- $stmt_id = oci_parse($c, $zapisFirmu);
- oci_bind_by_name($stmt_id, ':param1', $fname);
- oci_bind_by_name($stmt_id, ':param2', $ico);
- oci_bind_by_name($stmt_id, ':param2', $email);
- oci_bind_by_name($stmt_id, ':param2', $street);
- oci_bind_by_name($stmt_id, ':param2', $housenumber);
- oci_bind_by_name($stmt_id, ':param2', $city);
- oci_bind_by_name($stmt_id, ':param2', $psc);
- oci_bind_by_name($stmt_id, ':param2', $state);
- oci_execute($stmt_id);
- oci_close($c);
- $oracle->close();
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement