Forum Moderators: coopster

Message Too Old, No Replies

processing php form data

         

nshack31

10:30 am on Jun 9, 2008 (gmt 0)

10+ Year Member



I have a while loop that reads players ID and DOB from the database then creates a text input type for the data.....

<input type="text" id="demo$PlayerID" name="$PlayerID" value="$PlayerDOB" size="10">

my problem is i wish to then submit this data and have the DOB updated for each player ID. so....

update PlayerDOB where PlayerID = the PlayerID from the input type. how would I do this?!

thanks!

vanik

10:47 am on Jun 9, 2008 (gmt 0)

10+ Year Member



$DOB=$_POST['dob'];
$pid=$_POST['pid'];
update tablename set PlayerDOB=$DOB where PlayerID='".$pid."';
Took the posted values into new variables and update the table.

nshack31

10:53 am on Jun 9, 2008 (gmt 0)

10+ Year Member



hi would using $_POST['pid'] work because the text input field does not have a set name. It currently uses $PlayerID which is an integer that differs for each player

vanik

11:01 am on Jun 9, 2008 (gmt 0)

10+ Year Member



I think it would be a primary key.Right?
If,take playerid as $_REQUEST['pid'] from the previous page and then put
where PlayerID='".$_REQUEST['pid'].'"