Jump to content

Recommended Posts

Hi Everyone,

 

I'm new to PHP freaks, and I'm hoping someone might be able to help me.  I have written some code for a html page and used php to retrieve confirm whether or not data is in a text file.  I also tried to write some code to insert the data supplied to my html page to the text file but it's not working.  Can someone help me figure out what my issue is.

 

I have attached my text file, and my php code as well. Below you'll find the code I used for my html page.

 

Thank you for all your help,

Phee

 

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Telephone Directory</title>

</head>

<body>

<form action='SignGuestBook.php' method='post'>

 

<h1>Sign Guest Book</h1>

<hr>

<br>

<table align='Left'>

<tr>

<td>Name: </td>

<td><input name='name' /></td>

</tr>

<tr>

<td>E-mail: </td>

<td><input name='email' /></td>

</tr>

<tr>

<td><input type="submit" value='Sign' /></td>

<td><input type="reset" value='Reset Form' /></td>

</tr>

</table>

<h3></h3>

<br>

<h4></h4>

<br>

<h5></h5>

<br>

<h6></h6>

<br>

<h7></h7>

<br>

<hr>

 

<a href="http://helios.ite.gmu.edu/~smohamu2/IT207/Lab%20Assignment%208/AddNew.html">View Guest Book</a>

</form>

</body>

</html>

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/251505-form-data-not-writing-to-text-file/
Share on other sites

If i were you, I would use a mysql db to store all entries, its much easier done with the coding works.

 

I would have the table structure as this

 

=================

|| name || email || text ||

=================

 

have fun :)

its still not writing to the text file

 

What symptom do you see in front of you when you try it? Without knowing that, it would be impossible for anyone here to actually help you with what your code and your data is doing on your server.

 

What debugging have you done to pin down what execution path your code is taking? Finding at what point your code and data is dong what you expect and at what point it is not (I can guarantee that the problem lies between those two points) is how you debug code that doesn't work.

 

As already mentioned by Alexv, you should have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you by reporting and displaying all the errors it detects. The original error that was pointed out is a fatal parse error and php's error_reporting/display_errors would have pointed out an error in that line of code. You will save a TON of time and if you are in a classroom situation, the development system you are using should already be set up this way and/or you instructor should have made a point of the importance of setting the php error reporting settings during development, before you ever tried running your first .php script.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.