SkyRanger Posted March 21, 2012 Share Posted March 21, 2012 I am wondering if there is a way to update a certain row based on form? <form> ddbox entrys a b c d postdata = text goes here </form> update page: if ddtext = a update table set a = postdata else if ddtext = b update table set b = postdata etc is this possible? Link to comment https://forums.phpfreaks.com/topic/259450-update/ Share on other sites More sharing options...
smerny Posted March 21, 2012 Share Posted March 21, 2012 don't entirely understand your pseudo <form>, but from what i can tell i don't see a reason why it wouldnt be possible. Link to comment https://forums.phpfreaks.com/topic/259450-update/#findComment-1329979 Share on other sites More sharing options...
SkyRanger Posted March 21, 2012 Author Share Posted March 21, 2012 Yeah got sloppy putting the form demo in <form method=post action=updatedata.php> Choose Section :<select name="section"> <option></option> <option>a</option> <option>b</option> </select></form> Page Info:<textarea name="areadata" style="width: 234px; height: 121px"></textarea> <nput type=button name=submit value=Enter Data> on the updatedata page i would have if section==a update table set a=areadata else if section==b update table set b=areadata etc... This will work or is there an easier way to do this? Link to comment https://forums.phpfreaks.com/topic/259450-update/#findComment-1329982 Share on other sites More sharing options...
smerny Posted March 21, 2012 Share Posted March 21, 2012 well the options will need values on your table though, what are a and b? fields? it would set the field in every row values? syntax is off.. would be something like UPDATE table SET somefield='$areadata' WHERE someotherfield='a' Link to comment https://forums.phpfreaks.com/topic/259450-update/#findComment-1329985 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.