Please note the single quotes.

Using double quotes:

$variable = $_POST["$var"];

will not work, because you don't have a variable named $var in your code.

Have a look at

http://www.php.net/manual/en/language.types.string.php



-----Original Message-----
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:18 PM
To: Stephen; PHP List
Subject: RE: [PHP] Stumped...


Don't write code which requires register_globals to be on.

$variable = $_POST['$var'];


-----Original Message-----
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:03 PM
To: Timothy Hitchens (HiTCHO)
Cc: PHP List
Subject: Re: [PHP] Stumped...


Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
    for($i = 1; $i <= $vars; $i++) {
     $tempvar = 'var'.$i;
     $variable .= $$tempvar.',';
    }

All this gives me is this since I have three fields input:

    ,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


----- Original Message -----
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do "SELECT * FROM accounts WHERE num_rec LIKE '5'"  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
: > -----Original Message-----
: > From: Stephen [mailto:[EMAIL PROTECTED]]
: > Sent: Thursday, 9 January 2003 12:28 PM
: > To: Timothy Hitchens (HiTCHO)
: > Subject: Re: [PHP] Stumped...
: >
: >
: > Thank you much, but what did you mean I can't store numbers
: > up to 45, 768, etc?
: > ----- Original Message -----
: > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > To: "'PHP List'" <[EMAIL PROTECTED]>
: > Sent: Wednesday, January 08, 2003 9:21 PM
: > Subject: RE: [PHP] Stumped...
: >
: >
: > : Check out:
: > :
: > : http://www.php.net/manual/en/function.serialize.php
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: [EMAIL PROTECTED]
: > :
: > : > -----Original Message-----
: > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > Sent: Thursday, 9 January 2003 12:13 PM
: > : > To: Timothy Hitchens (HiTCHO)
: > : > Cc: PHP List
: > : > Subject: Re: [PHP] Stumped...
: > : >
: > : >
: > : > How would I serialise it? I can make the numbers into an
: > : > array, but if I echo the array itself, I'd get "Array" and I
: > : > need the number in the db, not the word...
: > : >
: > : >
: > : > ----- Original Message -----
: > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > To: "'Stephen'" <[EMAIL PROTECTED]>
: > : > Cc: "'PHP List'" <[EMAIL PROTECTED]>
: > : > Sent: Wednesday, January 08, 2003 9:09 PM
: > : > Subject: RE: [PHP] Stumped...
: > : >
: > : >
: > : > : What you can do it simply get the data and create an array
: > : > serialise the
: > : > : array and sent it to
: > : > : the database ... the issue that arises from this is
: > that you can't
: > : > : select if that record has
: > : > : 45 and 786 etc etc
: > : > :
: > : > : The other option you have is to create a table then a
: > : > second table that
: > : > : has entries that show
: > : > : you which numbers it has:
: > : > :
: > : > : Table 1:
: > : > :
: > : > : Code
: > : > : Name
: > : > : etc
: > : > :
: > : > : Table 2:
: > : > :
: > : > : Code
: > : > : Number
: > : > :
: > : > : You will end up with multiple numbers listed in table 2 but
: > : > you can then
: > : > : easily find everyone with number 45.
: > : > :
: > : > :
: > : > :
: > : > : Timothy Hitchens (HiTCHO)
: > : > : Open Platform Consulting
: > : > : e-mail: [EMAIL PROTECTED]
: > : > :
: > : > : > -----Original Message-----
: > : > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > : > Sent: Thursday, 9 January 2003 12:00 PM
: > : > : > To: Timothy Hitchens (HiTCHO)
: > : > : > Cc: PHP List
: > : > : > Subject: Re: [PHP] Stumped...
: > : > : >
: > : > : >
: > : > : > I will later select them and display them to be edited, but
: > : > : > other then that, not really...
: > : > : >
: > : > : >
: > : > : > ----- Original Message -----
: > : > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > : > To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'"
: > : > : > <[EMAIL PROTECTED]>
: > : > : > Sent: Wednesday, January 08, 2003 8:58 PM
: > : > : > Subject: RE: [PHP] Stumped...
: > : > : >
: > : > : >
: > : > : > : Do you require searching of this data eg... select via
: > : > : > these numbers or
: > : > : > : not??
: > : > : > :
: > : > : > :
: > : > : > : Timothy Hitchens (HiTCHO)
: > : > : > : Open Platform Consulting
: > : > : > : e-mail: [EMAIL PROTECTED]
: > : > : > :
: > : > : > :
: > : > : > : -----Original Message-----
: > : > : > : From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > : > : Sent: Thursday, 9 January 2003 11:56 AM
: > : > : > : To: PHP List
: > : > : > : Subject: [PHP] Stumped...
: > : > : > :
: > : > : > :
: > : > : > : Sorry for so many questions but this should be the last one
: > : > : > for a while.
: > : > : > :
: > : > : > : I have a form that I want to insert into a MySQL table.
: > : > This form is
: > : > : > : based on how many entries a user wants to enter. For
: > : > example, a user
: > : > : > : wants to type in 12 names, so 12 form fields appear. Or
: > : > : > they want 50, 50
: > : > : > : appear. What I want to do is store them all into a
: > : > database, but for
: > : > : > : one, I can't quit figure out how I can insert them, and
: > : > : > second, even if
: > : > : > : I did know how, I couldn't possibly make enough tables
: > : > : > unless I made 999
: > : > : > : since I put the char limit to 3 digits. How could I work
: > : > : > this keeping in
: > : > : > : mine any number between 1 and 999 could be entered and
: > : > : > without making
: > : > : > : 999 tables?
: > : > : > :
: > : > : > : Thanks,
: > : > : > : Stephen Craton
: > : > : > : http://www.melchior.us
: > : > : > :
: > : > : > : "What's the point in appearance if your true love, doesn't
: > : > : > care about
: > : > : > : it?" -- http://www.melchior.us
: > : > : > :
: > : > : > :
: > : > : > :
: > : > : >
: > : > : >
: > : > :
: > : > :
: > : > :
: > : >
: > : >
: > : >
: > : > --
: > : > PHP General Mailing List (http://www.php.net/)
: > : > To unsubscribe, visit: http://www.php.net/unsub.php
: > : >
: > :
: > :
: > : --
: > : PHP General Mailing List (http://www.php.net/)
: > : To unsubscribe, visit: http://www.php.net/unsub.php
: > :
: > :
: > :
: >
: >
:
:



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to