Git Product home page Git Product logo

test-online-code's Introduction

soal 2 - PHP Logic

Source Code

<?php
$input_user_filtered = false;

if (isset($_POST['submit'])) {
    $input_user = $_POST['input'];
     
    $age = preg_replace('/[^0-9]/', '', $input_user);
    
    $age_index_position = strpos($input_user, $age[0]);

    $name = substr($input_user, 0, $age_index_position);
    
    $city = substr($input_user, $age_index_position + strlen($age));
    
    $invalid_text = [
        'Tahun',
        'TH'
    ];
    
    $city = str_replace($invalid_text, '', $city);
    $input_user_filtered = true;
}

?>

<form action="/" method="post">
    text input : <input type="text" name="input" required>
    <button type="submit" name="submit">submit</button>
</form>

<?php if ($input_user_filtered) : ?>
    <table border="2" cellpadding="4" cellspacing="0">
        <tr>
            <th>Nama</th>
            <th>Usia</th>
            <th>Kota</th>
        </tr>
        <tr>
            <td><?= $name; ?></td>
            <td><?= $age; ?></td>
            <td><?= $city; ?></td>
        </tr>
    </table>
<?php endif; ?>

Hasil program

alt text

link demo : http://test-online-code.rf.gd/soal-2/

Soal 3 RDBMS

Tampilkan nama film dengan artis bayaran terendah dalam bentuk query

alt text

Tampilkan nama film yang dibintangi oleh artis yang huruf depannya 'j' dalam bentuk query

alt text

Soal 4 REST API

Daftar Pengguna

alt text

Detail Pengguna

alt text

test-online-code's People

Contributors

gagassss avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.