You don't do it in the INSERT statement, rather you do it in the portion of the
PHP script where it is checking to see if you have entered anything into the
<input /> fields. Your INSERT stays the same as it was originally, you just
need to create the variables in your script, then use them in the INSERT.
BEing new to this also, I would definitely recommend buying Larry Ullman's book
PHP and MySQL for building Dynamic Website 2nd Edition. I have had the hardest
time with all this too, and since reading this book it has become a lot clearer
for me.
Nick
"D. K. Wema" <[EMAIL PROTECTED]> wrote: Nick, how do I do that in an insert
statement? I am
lost):!
--- Nick Vettese <[EMAIL PROTECTED]> wrote:
> It may be a little extra code, but you can set it up
> to keep your current variables as well. Just do a
>
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'[;
> etc...
>
> nick
>
> Nick Jones <[EMAIL PROTECTED]> wrote: Check
> your php.ini file and see if "Register Globals"
> is turned on or not. It seems to me that your
> variables aren't populated with anything because
> the
> register globals switch is off. You have two
> options:
> turn on register globals (not usually a good idea),
> or
> change your variable names from $firstname,
> $lastname,
> etc. to $_POST['firstname'], $_POST['lastname'],
> etc.
>
> LMK if this works.
> Thanks and HTH!,
> -Nick
>
> --- "D. K. Wema" <[EMAIL PROTECTED]> wrote:
>
> > I counter checked and found no mis-typing.
> >
> > --
> > dk wema
> >
> > --- Nick Vettese <[EMAIL PROTECTED]> wrote:
> >
> > > If the code goes through when the VALUES are
> hard
> > > coded, it probably means that the strings are
> > > mis-typed.
> > >
> > > nick
> > >
> > > Ian Bambury <[EMAIL PROTECTED]> wrote:
> As
> > you
> > > say, it would appear that you have a problem
> > > elsewhere and that this
> > > code is not being executed at all.
> > > From what you have posted, the script must be
> > > dying in dbconnect.php
> > > If you'd like to post that, I'll have a look.
> > > Ian
> > >
> > > On 18/11/05, D. K. Wema <[EMAIL PROTECTED]>
> > wrote:
> > > >
> > > > I am sorry, Ian, I'm quite new in this. OK,
> I
> > > tried
> > > > echo $sql; but got no output. However, when
> I
> > > used the
> > > > hardcoded insert without using the form, I
> got
> > > the
> > > > following output:
> > > >
> > > > Information entered into address book.
> > > >
> > > > INSERT INTO addressbook (firstname,
> lastname,
> > > cpeyear,
> > > > city, country, workplace, email, comments)
> > VALUES
> > > > ('Peter','Long','1986','Leeds','United
> > > > Kingdom','Wallmart,'[EMAIL PROTECTED]','We
> just
> > > echoed
> > > > the field information into the value
> attribute
> > of
> > > the
> > > > each element, which was fairly easy')
> > > >
> > > >
> > > > I suspect that the error could be somewhere
> in
> > my
> > > > form, but I cannot get it.
> > > >
> > > > --
> > > > dk wema
> > > >
> > > > --- Ian Bambury <[EMAIL PROTECTED]>
> wrote:
> > > >
> > > > > What I meant was, can you put a line in
> of:
> > > > > echo $sql;
> > > > > and see what you get
> > > >
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Yahoo! FareChase: Search multiple travel
> sites
> > in
> > > one click.
> > > > http://farechase.yahoo.com
> > > >
> > > >
> > > > Community email addresses:
> > > > Post message: [email protected]
> > > > Subscribe:
> [EMAIL PROTECTED]
> > > > Unsubscribe:
> > [EMAIL PROTECTED]
> > > > List owner: [EMAIL PROTECTED]
> > > >
> > > > Shortcut URL to this page:
> > > > http://groups.yahoo.com/group/php-list
> > > >
> > > >
> > > >
> > > > SPONSORED LINKS
> > > > Php
> > >
> >
>
>
mysql<http://groups.yahoo.com/gads?t=ms&k=Php+mysql&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=FLGkJVBUdDMln4PBO26sng>
> > > Job
> > > >
> > >
> >
>
>
postings<http://groups.yahoo.com/gads?t=ms&k=Job+postings&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=cV3rp9pSpCxahJy7imon_w>
> > > > ------------------------------
> > > > YAHOO! GROUPS LINKS
> > > >
> > > >
> > > > - Visit your group
> > >
> "php-list<http://groups.yahoo.com/group/php-list>"
> > > > on the web.
> > > > - To unsubscribe from this group, send
> an
> > > email to:
> > > >
> > >
> >
>
>
[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> > > > - Your use of Yahoo! Groups is subject
> to
> > the
> > > Yahoo! Terms of
> > > > Service
> <http://docs.yahoo.com/info/terms/>.
> > > >
> > > >
> > > > ------------------------------
> > > >
> > >
> > >
> > > [Non-text portions of this message have been
> > > removed]
> > >
> > >
> > >
> > > Community email addresses:
> > > Post message: [email protected]
> > > Subscribe:
> > [EMAIL PROTECTED]
> > > Unsubscribe:
> > > [EMAIL PROTECTED]
> > > List owner: [EMAIL PROTECTED]
> > >
> > > Shortcut URL to this page:
> > > http://groups.yahoo.com/group/php-list
> > >
> > >
> > >
> > > SPONSORED LINKS
> > >
>
> >
> > > Php mysql
> > Job
> > > postings
>
> >
> > >
> > >
> > > ---------------------------------
> > > YAHOO! GROUPS LINKS
> > >
> > >
> > > Visit your group "php-list" on the web.
> > >
>
=== message truncated ===
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
SPONSORED LINKS
Php mysql
Job postings
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "php-list" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Check me out!
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/u8TY5A/tzNLAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/