Anonymous Data in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
misslilbit02
Forum Newbie
Posts: 9
Joined: Mon Sep 18, 2006 3:57 pm

Anonymous Data in PHP

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post 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.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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
}
Post Reply