Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Conditional Input</title>
- </head>
- <body>
- <div id='container'>
- <div id='input_box'>
- <form method="POST">
- <table border='1'>
- <tr>
- <td>Ketertarikan</td>
- <td>
- <input type='radio' name='field' value='sm' checked='checked'/> Sangat Menarik<br/>
- <input type='radio' name='field' value='me'/> Menarik<br/>
- <input type='radio' name='field' value='km'/> Kurang Menarik
- </td>
- </tr>
- <tr>
- <td>Berikan nilai untuk Ketertarikan</td>
- <td><input name="nilai" /> Nilai rentang 10-100</td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="submit" value="kirim" />
- </td>
- </table>
- </form>
- </div>
- <div id='result_box'>
- <?php
- if(isset($_POST['nilai']))
- {
- echo "INSERT INTO table(sm,me,km) VALUES("
- .($_POST['field']=='sm'?$_POST['nilai']:"0").","
- .($_POST['field']=='me'?$_POST['nilai']:"0").","
- .($_POST['field']=='km'?$_POST['nilai']:"0").")";
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement