Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = '127.0.0.1';
- $port = '5432';
- $database = 'aaa';
- $user = 'postgres';
- $password = 'admin1234';
- $connectString = 'host=' . $host . ' port=' . $port . ' dbname=' . $database . ' user=' . $user . ' password=' . $password;
- $link = pg_connect ($connectString);
- if (!$link) {
- die('Error: Could not connect: ' . pg_last_error());
- }
- if(isset($_POST['source'])) {
- //var_dump($_POST['source']);
- foreach($_POST['source'] as $value){
- // $val = serialize($value);
- var_dump($value);
- $insert = "INSERT INTO source_of_fund_value(source_of_fund_1) VALUES ('". $value ."')";
- pg_query($insert);
- }
- }
- ?>
- <html>
- <body>
- <form method="post" action="">
- <input type="checkbox" name="source[]" value="salary">Salary
- <input type="checkbox" name="source[]" value="inheritance"> Inheritance
- <input type="checkbox" name="source[]" value="pension_fund"> Pension Fund
- <input type="checkbox" name="source[]" value="others"> Others
- <input type="submit" name="submit" value="submit">
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment