All pastes #906488 Raw Edit

Miscellany

public php v1 · immutable
·published 2008-02-16 19:16 UTC
rendered paste body
$labels = array ('first_name' => 'First Name: ','middle_name' => 'Middle Name: ','second_name' => 'Second Name: ','tel' => 'Tel: ');if(count($_POST) ==  0) {echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"><table>';foreach($labels as $field => $value){        echo '<tr><td>'.$value.'</td><td><input type="text" name="'.$field.'" size="15"></td></tr>';}echo '</table><input type="submit" value="Sumit">';echo '</form>';exit();} else {foreach($_POST as $field => $values){        if($field != 'middle_name')        {                if($value == '')                {                        $blank_array[] = $field;                }        }}if(sizeof($black_array) > 0){        echo '<b>You didn\'t fill in one or more required fields. You must enter:<br>';        foreach($blanck_array as $value)        {        echo $value.'<br>';        }        echo '<table border="1"><form action="'.$_SERVER['PHP_SELF'].'" method="post">';        foreach($labels as $field => $value)        {        $good_data[$field] = strip_tags(trim($_POST[$field]));                echo '<tr><td>'.$labels[$field].'</td><td><input type="text" name="'.$field.'" size="15" maxlength="15" value="'.$good_data[$field].'"></td></tr>';        }        echo '</tabble><input type="submit" value="Sumit">';        echo '</form>';        exit();}}?>