Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function process_submitted_data() {
- $arr = array();
- $arr['name'] = $_POST['name'];
- $arr['Work Experience'] = $_POST['work_exp'];
- $arr['Work Experience Max'] = $_POST['work_exp_max'];
- $arr['company'] = $_POST['company'];
- $arr['location'] = $_POST['location'];
- var_export($arr); echo ' ... sent array <br/>';
- if (trim($arr["Work Experience Max"])=='') {
- $arr["Work Experience Max"] = $arr["Work Experience"];
- }
- echo '<br/>'; var_export($arr); echo ' ... modified array';
- //file_put_contents('saved_values.php', '$arr='.var_export($arr,true).';'); //save received data to file on server
- }
- function show_form() {
- echo '<div style="margin:1em 0">';
- echo '<form action="" method="post">';
- echo '<input type"text" name="name" value="" > Name <br/>';
- echo '<input type"text" name="work_exp" value="" > Work Exp. <br/>';
- echo '<input type"text" name="work_exp_max" value="" > Work Exp. Max <br/>';
- echo '<input type"text" name="company" value="" > Company <br/>';
- echo '<input type"text" name="location" value="" > Location <br/>';
- echo '<input type="submit" name="send" value="Send form" >';
- echo '</form>';
- echo '<div>';
- }
- ?>
- <html>
- <body>
- <h5> http://stackoverflow.com/questions/11386521/php-remove-the-value-from-array/11386984 </h5>
- <?php
- if (isset($_POST['send'])) {
- process_submitted_data();
- }
- show_form();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement