Guys
thanx a million ... this is what works
......snip..............
if ($_POST['submit']) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb", $db);
$insert_data = "INSERT INTO employees (first, last, address,
position ) VALUES ( '$_POST[first]', '$_POST[last]',
'$_POST[address]', '$_POST[position]' );";
$result = mysql_query( $insert_data, $db );
......snip..............
Took me a bit to figure this out with trial and error and of course
your help.
Above you see in the INSERT INTO I have the values in this format
'$_POST[first]'
Based on the info in your reply I was trying
$_POST("$first")
'$_POST("$first")'
'$_POST('$first')'
and so on .. until I finally got it to work
But thanx for putting me on the right track.
I'm sure I'll be back here again.
Thanx
Roger
sdeyoreo@hotmail.com wrote in message news:<q55450p6dt17an90vh09s8jaluqeq681qd@4ax.com>. ..[color=blue]
> I had trouble with thier tutorials also. They seem to left out
> $_POST(" "). The submit button and all stuff from a form are in the
> $_POST coolection, meaning the right way to say it is
> $_POST("$submit") or if it was text from a textbox, it woyuld be in
> $_POST("$FormText or whatever the textbox name is"). If the form uses
> GET method, the collection is $_GET("")
> On 12 Mar 2004 09:36:52 -0800,
spacemancw@yahoo.com (spacemancw)
> wrote:
>[color=green]
> >I'm reading an article on MySQL/PHP at
> >
http://hotwired.lycos.com/webmonkey/...tw=programming
> >
> >It's very good for me starting out but I have a question.
> >
> >I'm using OS X Panther 10.3.2
> >
> >MySQL 4.0.15
> >
> >PHP 4.3.2 (cli) (built: Sep 13 2003 22:04:20)
> >Copyright (c) 1997-2003 The PHP Group
> >Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
> >
> >Apache/1.3.29 (Darwin)
> >
> >
> >Following the tutorial things are looking good up until "Throw in Some
> >Forms" in Lesson 2.
> >
http://hotwired.lycos.com/webmonkey/...tw=programming
> >There is a form as follows
> >
> > .....snip..............
> >
> >if ($submit) {
> >
> > // process form
> >
> > while (list($name, $value) = each($HTTP_POST_VARS)) {
> >
> > echo "$name = $value<br>\n";
> >
> > }[/color]
>[color=green]
> >} else{
> >
> > // display form
> >
> > .....snip..............
> >
> >and the next form after that also.
> >I pull up the forms which I have called fpage2.php and fpage3.php
> >In the first form fpage2.php, it should display the input fields the
> >first time you access it. Then when you fill it in, 'submit' now has a
> >value, so the return page should list the values just entered. It
> >doesn't, it just shows the form again.
> >
> >In the next form fpage3.php, it should display the input fields the
> >first time you access it. Then when you fill it in, 'submit' now has a
> >value, so the return page should display "Thank you! Information
> >entered." and the data should be inserted into mydb. It doesn't, it
> >just shows the form again.
> >
> >So it's as if the 'if/else' statement doesn't get a positive with the
> >if ($submit) {
> >and so it just moves on to the 'else'.
> >
> >I just copied and pasted ther forms into a file using VI on the
> >command line and didn't edit them in any way.
> >
> >Now this was for PHP 3. Is that fact that I have PHP 4 a problem. Is
> >there a change I should make?
> >
> >Any help would be appreciated.
> >
> >Thanx
> >
> >rmc[/color][/color]