Page 1 of 1

Anonymous Data in PHP

Posted: Mon Aug 20, 2007 8:29 am
by misslilbit02
Hi,

I have a question that I need help with...I have data coming across the URL from an outside source and I I don't know what the $_POST values are. Is there a way for me to get the information and put it into the database without knowing the values being past across the browser and if so how would I go about doing that?

I know you would have mssql_query("INSERT INTO DATABASE_TABLE(column1, column2, coulmn3) VALUES (value1, value2, value3)");

I know how to get the data through a loop but my confusion comes in where you input the values into the database. Without knowing the data how would you insert the values into the database?

Posted: Mon Aug 20, 2007 8:33 am
by feyd
foreach.

If forced, I would toss the data into a single large column for later processing, since you have no clue as to the format information may come in.

Posted: Mon Aug 20, 2007 8:35 am
by miro_igov
If your values come from the URL then you need the $_GET collection (ASP style sentence :) ). You do not know the values - this is why variables are used so you never know the exact value which comes. maybe you do not know the variable names. There should be some rule for that, finding it will help you saving the data in database.

You can post examples here and get some help.

Posted: Mon Aug 20, 2007 8:39 am
by CoderGoblin
Don't forget the syntax for foreach can be...

Code: Select all

foreach ($_POST as $key=>$value) {
  //key will be the index/varname 
  //value will be well ...the value
}