I've got it currently as method=get; I thought it had to be get in order to
manipulate variables in the URL, as I've got them...have I thought wrong?


----- Original Message ----- 
From: "Ross Honniball" <[EMAIL PROTECTED]>
To: "Dan Bowkley" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 11:53 PM
Subject: Re: [PHP-DB] lamer noob with repeat question


> Have you tried putting in a
>
> <form method="post" action="script-name.php">
>
> in your html?
>
> I'm haven't read all of your email but this is what I use and your html
> doesn't seem to have this. I think php needs  the 'action=' to know what
to
> do when the user submits the form.
>
> At 04:37 PM 4/05/2004, you wrote:
> >Anyone?
> >----- Original Message -----
> >From: "Dan Bowkley" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, May 02, 2004 1:21 AM
> >Subject: [PHP-DB] lamer noob with repeat question
> >
> >
> > > Hello everyone,
> > >
> > > I've been working on (read:tearing my hair out over) my mom's website
for
> > > some time now.  Specifically, I'm trying to get her work order
database up
> > > and running.
> > >
> > > The basic idea is this: you start out adding a new record by going to
> > > add.php.  It sees that you've not done anything yet and thus presents
you
> > > with a form to fill out.  That form gets submitted to add.php, which
sees
> > > that you're adding something.  It checks for a duplicate work order
number
> > > (and eventually other errors) and then either adds the stuff you
submitted
> > > into the DB, or pops an error and presents the form again.
> > >
> > > Alas, it does nothing.
> > >
> > > When you initially load the page, it works okay, sensing that you've
not
> >yet
> > > done anything and displaying the form.  But when you submit data, it
spits
> > > out naught more than a blank page, and doesn't add anything to the
> >database.
> > >
> > > Damned lazy script.
> > >
> > >
> > > What I've got so far is this:
> > >
> > > <html>
> > > <head><title>The Board Lady - Work Order Database 0.1a</title></head>
> > > <body>
> > > <?php
> > > define ('DB_USER', 'user');
> > > define ('DB_PASSWORD', '********');
> > > define ('DB_HOST', 'localhost');
> > > define ('DB_NAME', 'boardlady');
> > > $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could
not
> > > connect to database: ' . mysql_error());
> > > @mysql_select_db (DB_NAME) OR die ('Could not connect to database: ' .
> > > mysql_error());
> > > $page_req=$HTTP_GET_VARS['action'];
> > > if ($page_req == "") {$page_req="0";}
> > > if ($page_req == "0") {
> > > echo "SWORD data entry<br>\n";
> > > echo "<form action=\"add.php\" method=\"get\">";
> > > echo "Work Order #: <input type=\"text\" name=\"wo_num\"><br>\n";
> > > echo "Customer Name: <input type=\"text\" name=\"name\"> Phone: <input
> > > type=\"text\" name=\"phone\"><br>\n";
> > > echo "Email Addy: <input type=\"text\" name=\"email\"> Date In: <input
> > > type=\"text\" name=\"date\"><br>\n";
> > > echo "Board Type and SN: <input type=\"text\" name=\"board_type\">
Last 3
> >of
> > > SN: <input type=\"text\" name=\"last_three\"><br>\n";
> > > echo "Weight In: <input type=\"text\" name=\"weight_in\"> Weight Out:
> ><input
> > > type=\"text\" name=\"weight_out\"><br>\n";
> > > echo "<input type=\"hidden\" name=\"action\" value=\"1\">\n";
> > > echo "<INPUT type=\"submit\" value=\"Add Work Order\"> <INPUT
> > > type=\"reset\"><br>\n";
> > > }
> > > if ($page_req == "1") {
> > > $wo_num=$HTTP_GET_VARS['wo_num'];
> > > $name=$HTTP_GET_VARS['name'];
> > > $phone=$HTTP_GET_VARS['phone'];
> > > $email=$HTTP_GET_VARS['email'];
> > > $date=$HTTP_GET_VARS['date'];
> > > $board_type=$HTTP_GET_VARS['board_type'];
> > > $last_three=$HTTP_GET_VARS['last_three'];
> > > $weight_in=$HTTP_GET_VARS['weight_in'];
> > > $weight_out=$HTTP_GET_VARS['weight_out'];
> > > $query_testingforadupe = "SELECT job_no FROM boards WHERE job_no ==
> >$job_no
> > > ORDER BY job_no ASC";
> > > $result_testingforadupe = @mysql_query ($query_testingforadupe);
> > > if ($result_testingforadupe) {
> > > echo "That's a duplicate work order number, you ditz. Try again, this
time
> > > without screwing it all up.<br><br>\n";
> > > echo "<form action=\"add.php\" method=\"get\">";
> > > echo "Work Order #: <input type=\"text\" name=\"wo_num\"><br>\n";
> > > echo "Customer Name: <input type=\"text\" name=\"name\"> Phone: <input
> > > type=\"text\" name=\"phone\"><br>\n";
> > > echo "Email Addy: <input type=\"text\" name=\"email\"> Date In: <input
> > > type=\"text\" name=\"date\"><br>\n";
> > > echo "Board Type and SN: <input type=\"text\" name=\"board_type\">
Last 3
> >of
> > > SN: <input type=\"text\" name=\"last_three\"><br>\n";
> > > echo "Weight In: <input type=\"text\" name=\"weight_in\"> Weight Out:
> ><input
> > > type=\"text\" name=\"weight_out\"><br>\n";
> > > echo "<input type=\"hidden\" name=\"action\" value=\"1\">\n";
> > > echo "<INPUT type=\"submit\" value=\"Add Work Order\"> <INPUT
> > > type=\"reset\"><br>\n";
> > > }
> > > else {
> > > $query_insert = "INSERT INTO boards (wo_num, name, phone, email, date,
> > > board_type, last_three, weight_in, weight_out) VALUES (\'$wo_num\',
> > > \'$name\', \'$phone\', \'$email\', \'$date\', \'$board_type\',
> > > \'$last_three\', \'$weight_in\', \'$weight_out\')";
> > > $result_insert = @mysql_query ($query_insert);
> > > if ($result_insert == "") {
> > > echo "<input type=\"hidden\" name=\"action\" value=\"0\"\n";
> > > echo "<INPUT type=\"submit\" value=\"Continue\">\n";
> > > }
> > > else {echo "OOPS! Your programmer is an idiot!\n";}
> > > }}
> > > mysql_close();
> > > ?>
> > > </body>
> > > </html>
> > >
> > >
> > >
> > >
> > >
> > > The database looks like this, in case you're curious:
> > > CREATE TABLE boards (
> > >   name varchar(40) default NULL,
> > >   phone varchar(12) default NULL,
> > >   email varchar(40) default NULL,
> > >   purveyor varchar(40) default NULL,
> > >   job_no int(5) unsigned NOT NULL default '0',
> > >   date varchar(10) NOT NULL default '',
> > >   board_type varchar(100) NOT NULL default '',
> > >   weight_in decimal(4,2) default NULL,
> > >   weight_out decimal(4,2) default NULL,
> > >   last_three int(3) unsigned default NULL,
> > >   PRIMARY KEY  (job_no),
> > >   KEY last-three (last_three)
> > > ) TYPE=MyISAM;
> > >
> > >
> > > Can anyone help me to get this thing working?
> > >
> > > TIA
> > > Dan
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> . Ross Honniball                  JCU Bookshop Cairns Supervisor
> . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia
> . Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
> . There are no problems. Only solutions.
>
>
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to