cK Posted May 21, 2003 Share Posted May 21, 2003 Offcourse this doesnt work; I know... $query = "INSERT INTO application_form (something, email) VALUES (\'something\',\'$_POST[\'Email\']\')"; So how can I use $_POST[\'NAME\'] when inserting? Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/ Share on other sites More sharing options...
effigy Posted May 21, 2003 Share Posted May 21, 2003 $email = $_POST[\'Email\']; $query = \"INSERT INTO application_form (something, email) VALUES (\'something\',\'$email\')\"; Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1653 Share on other sites More sharing options...
cK Posted May 21, 2003 Author Share Posted May 21, 2003 I know ;-) But then I would need to define all vars; isn\'t there better solution? Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1655 Share on other sites More sharing options...
Avalanche Posted May 21, 2003 Share Posted May 21, 2003 I think you could do that with a for each thing, but I don\'t use for each myself. Anyway, I believe what you had at first would work if you got rid of the apostrophes in your POST variables. So, instead of $_POST[\'name\'] use $_POST[name]. See if that works. Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1657 Share on other sites More sharing options...
metalblend Posted May 21, 2003 Share Posted May 21, 2003 Actually it\'s much simpler than you think.. break from the string: $query = "INSERT INTO application_form (something, email) VALUES (\'something\',\'".$_POST[\'Email\']."\')"; Hope that helps. Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1658 Share on other sites More sharing options...
wompus Posted May 21, 2003 Share Posted May 21, 2003 Convert all your posted variables <?php foreach($_POST as $key => $item) { $key = $_POST[$key]; } ?> $_POST[\'name\'] could then be used just as $name Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1659 Share on other sites More sharing options...
Nairb Posted May 21, 2003 Share Posted May 21, 2003 Convert all your posted variables <?php foreach($_POST as $key => $item) { $key = $_POST[$key]; } ?> $_POST[\'name\'] could then be used just as $name OMG THANK YOU!!!!!!! Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1660 Share on other sites More sharing options...
cK Posted May 22, 2003 Author Share Posted May 22, 2003 metalblend thanks! I Forgot that PHP was so easy wompus, that\'s easy. But how about? $_POST[\'Name\'] and $_POST[\'Two words\'] Because that\'s actually why I use [\'Name\'] and not [name].... Link to comment https://forums.phpfreaks.com/topic/490-insert-_postname/#findComment-1667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.