Jump to content

Problem with 'sticky' data in POST form


Go to solution Solved by Jessica,

Recommended Posts

So I hate to bother everyone with what seems to be such a small question, but I assure you I DID search through the forums here looking for an answer... maybe I didn't search hard enough but the book I'm learning from couldn't help me with this problem either.

 

The code I'm working on is a basic mailing list application, made up of three PHP/HTML pages. One for adding emails to the MySQL database table, one to remove, and one to send an email to all the emails in the list.

 

Currently, I'm trying to learn how to make the Subject and Body fields 'sticky' in case the user makes an error and leaves a field blank in the send_email.php. I've tested it a bunch of times and tried to tweak it but the Body field won't stick! I can leave the body empty and add a subject, and the error comes up properly and the subject stays in the subject line, but if I do it the other way the body won't stick. I don't get it because the code is the same for both of them, at least as far as I can tell...

 

Here's a paste of send_email.php. (I blanked out my email and the database password for privacy reasons).

They're also teaching us to put everything in one page, instead of having two separate HTML and PHP pages. So I just migrated everything from the HTML page into the PHP page -- and it didn't affect this problem either way. So I think I did that part right.

 

Any and all help is MUCH appreciated!!

 

(PS also -- I do my coding on Linux (specifically Ubuntu and/or Fedora, and I would LOVE to have some sort of debugger for PHP... currently I'm using gedit with a bunch of extra plugins to support PHP coding (auto-completes, highlighting, etc) but I also have Eclipse, which I used to use for Java/Android SDK development. I know it has PHP support but it doesn't seem to work for me... does anyone have any tips? If I could get a debugger working I'm sure that would help solve a LOT of these problems!)

 

(PPS -- the website is currently live at http://aureliusr.mine.nu/ if you want to check it out)

Edited by AureliusR
Link to comment
https://forums.phpfreaks.com/topic/275870-problem-with-sticky-data-in-post-form/
Share on other sites

You are the debugger.

 

Edit: However putting your resultant HTML into an HTML Validator might have brought this specific problem to your attention. I use a Firefox plugin that shows me immediately if my site has any errors.

Edited by Jessica

Right but I mean a plugin of sorts that will go through the code line by line and actively show you how the variables are being changed, and what the interpreter is actually doing behind the scenes. I really like tools like this because they deepen your understanding of the language, and also of how the language actually interacts with all the functions and modules it comes into contact with...

 

Has anyone seen anything like this for PHP/MySQL? They have multitudes of them for C++, Java, etc... but I can't find much for PHP. Perhaps because it's a web-based language?

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.