Jump to content

ebh

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    Palatine, IL

ebh's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. register_globals is on. I commented out my if statement and the insertion code worked fine. After changing it per XSpikeX\'s suggestion (and trying his code with $_POST as well) the if statement still kicked me in the junk, so I just removed it. If I\'m designing an app and I\'m also the only user, I should be smart enough to fill in all the fields without having to babysit myself, right? :? Maybe I\'ll revisit checking field completion once I work out deleting bad entries and customizing the queries to show only what I want, when I want it. Fun stuff, this SQL and PHP... fun stuff. My fiancée is alreaddy hating how late I get to bed now... Ah well.
  2. What additional information should I provide? Your suggestion was a good one, however I would point out that ./ references the current directory. To reference one directory higher it would be ../ Just by trying to submit data to my insert.html form, the javascript to report errors in insert.php gets triggered, so I know at the very least insert.php is being parsed. Reading the tutorial you linked now...
  3. First off, let me state that as of two days ago I had never touched SQL -or- PHP and at this point all I\'ve managed to do is create my database, populate it with a small amount of data so I can work on it, and I\'ve learned how to query it via a little php page. Most of my work has been with phpMyAdmin although I did create my initial table via command line. That said, what I\'m working on now is trying to create a form I can hit from the web to insert data into my db. Currently I’ve got my insert.html form, and my insert.php files separated – I believe I can make it a single file if I’m not mistaken, but for now it seems easier for me to keep them split. As it stands right now, when I try to submit my form the javascript kicks me back and tells me I haven’t entered all the required values – It’s supposed to do this if the user leaves out a field, but since I’m completing my form then I assume it’s dying because the values aren’t being passed as variables to the php script. The purpose of this small db/form is simply to track a list of employees, a date, and if they submitted their report (or why they didn\'t) on that date. -- paste of insert.html -- <html> <head> <title>insert form</title> </head> <body> <form method="POST" action="./insert.php" name="form"> Advisor\'s Name<BR><input name="adv_name" type="text" id="adv_name" size="50"><BR> Record Date<BR><input name="rec_date" type="text" id="rec_date" size="10"><BR> Record Status<select name="rec_status" id="rec_status"> <option selected>Yes</option> <option value="No">No</option> <option value="Off Work">Off Work</option> <option value="Out Sick">Out Sick</option> <option value="Exempt">Exempt</option> </select> <BR> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> -- paste of insert.php -- [php:1:d09189e900]<?php // Check if the variables exist (if the form fields have been filled in) if (!$adv_name && !$rec_date && !$rec_status) { echo \"You failed to complete all required fields.\"; echo \"Click <A HREF=\"javascript:history.go(-1);\">« here</A> to try again\"; } else { // Connect to the sql database $link = mysql_connect(\"localhost\", \"viewer\"); $db = mysql_select_db(\"aiu\", $link); // The \'insert\' that will insert the data as a new row into your table $query = \"INSERT INTO adls_records (adv_name, rec_date, rec_status) VALUES (\'$_POST[adv_name]\', \'$_POST[rec_date]\', \'$_POST[rec_status]\')\"; $result = mysql_query($query, $link); // Echo this message to allow the user to access a new form echo \"Click <A HREF=\"./insert.html\">here</A> to add another record.\"; } ?>[/php:1:d09189e900] In the PHP script above, & is correctly entered as & I finally got to the point where I\'ll admit I\'m stuck and ask for help, and this seems to be the place for it. Anyone have some advice?
×
×
  • 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.