dannyone Posted March 2, 2009 Share Posted March 2, 2009 im populating a dropdown box dynamically and this is working fine, im selecting roomid,roomname and building and then posting the variable $nt. heres the basics of my 1st page: $nt = $_POST["Room_ID"]; $query=("select Rooms.Room_ID,Rooms.RoomName,Rooms.Building from Rooms"); echo "<option post value=$nt[Room_ID]>$nt[Room_ID], $nt[RoomName], $nt[building]</option>"; then on the next page i am trying to use the value $nt. i have echo'd the $nt and it is stored when i first load the page. and it shows the records that i want it to. however i want it to update and insert into the database using this value and its not working, can some1 see were i am going wrong <?php $nt = $_POST["Room_ID"]; ?> echo "Room_ID is $nt:<br />"; @$todo=$_POST['todo']; // take care of register global if off if(isset($todo) and $todo=="submit_form"){ $days_array=$_POST['days_array']; $tag_string=""; while (list ($key,$val) = @each ($days_array)) { //echo "$val,"; $tag_string.=$val.","; } $tag_string=substr($tag_string,0,(strLen($tag_string)-1)); $result=(mysql_query("update Rooms_Free set timeslot='$tag_string', Room_ID='$nt'")); if(mysql_affected_rows()==0) { $result=mysql_query("INSERT INTO Rooms_Free (Room_ID, timeslot) VALUES('$nt', '$tag_string')"); }else{echo mysql_error();} i need to use Rooms.Room_ID = '$nt' and make it store into another table, Rooms_Free.Room_ID, so Rooms.Room_ID = Rooms_Free.Room_ID, but this aint working it just stores a 0 value in the roomid field. thanks Link to comment https://forums.phpfreaks.com/topic/147596-variable-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.