SHOW:
|
|
- or go back to the newest paste.
| 1 | <form name="web_form" id="web_form" method="post" action="process-form-data.php"> | |
| 2 | - | <p><label>Name: </label><input type="text" name="name" id="name" /></p> |
| 2 | + | <p><label>Name: </label><input type="text" name="name" id="name" /></p> <!-- typo duplicated id --> |
| 3 | - | <p><label>Email: </label><input type="text" name="email" id="email" /></p> |
| 3 | + | <p><label>Email: </label><input type="text" name="email" id="email" /></p> <!-- typo duplicated id --> |
| 4 | - | <p><label>Phone: </label><input type="text" name="phon" id="email" /></p> |
| 4 | + | <p><label>Phone: </label><input type="text" name="phon" id="email" /></p> <!-- typo duplicated id --> |
| 5 | - | <p><label>Address: </label><input type="text" name="add" id="email" /></p> |
| 5 | + | <p><label>Address: </label><input type="text" name="add" id="email" /></p> <!-- typo duplicated id --> |
| 6 | <p><input type="submit" name="1" id="s1" value="Submit" /></p> | |
| 7 | </form> | |
| 8 | ||
| 9 | php code : | |
| 10 | ||
| 11 | <?php | |
| 12 | $name = $_POST['name']; | |
| 13 | $email = $_POST['email']; | |
| 14 | $phon = $_POST['phon']; | |
| 15 | $add= $_POST['add']; | |
| 16 | $fp = fopen("mailing.txt", "a");
| |
| 17 | - | $savestring = $name . "," . $email .",".$phon."."$add. "n"; |
| 17 | + | $savestring = $name . "," . $email .",".$phon."."$add. "n"; \\ should be "\r\n" not "n". Why $phon and $add are not comma seperated? |
| 18 | fwrite($fp, $savestring); | |
| 19 | fclose($fp); | |
| 20 | echo "<h1>You data has been saved in a text file!</h1>"; | |
| 21 | ?> | |
| 22 | I have a text file mailing.txt | |
| 23 | with predefined format | |
| 24 | like : | |
| 25 | Name Email Phone Address | |
| 26 | ||
| 27 | when I will submit the form. | |
| 28 | the data must come (append) in each mentioned below column please help . |