jjmusicpro Posted March 26, 2008 Share Posted March 26, 2008 i am trying to post the variables that were put into a form, to post to another page, but cant get it to work. ALso, i dont know how to take those posted variables, and enter them into the db. <form id=\"form1\" name=\"form1\" method=\"post\" action=\"2008pumpplayeradd.php\"> If you dont have a team, but want to play, sign up here!<br /> Player Name: <label> <input type=\"text\" name=\"player_name\" /> </label> <br /> Phone Number: <label> <input type=\"text\" name=\"phone_number\" /> </label> <br /> Player Email. <label> <input type=\"text\" name=\"player_email\" /> </label> <br /> <label> <input type=\"submit\" name=\"Submit\" value=\"Submit\" /> </label> </form> here is whats on my form i am posting to $db = mysql_connect("localhost", "pump_user","xxxx") or die("Could not connect."); // Connection to DB $teamname = GET_("team_name"); $teamcaptain = GET_("team_captain"); $teamphone = GET_("team_number"); $teamemail = GET_("team_address"); if(!$db) die("no db"); if(!mysql_select_db("2008pump",$db)) die("No database selected."); $acc1="insert into id (teamname,teamcaptain,teamphone,teamemail) values ($teamname,$teamcaptain,$teamphone,$teamnail,now())"; $acc2=mysql_query($acc1) or die("Could not select accounts."); // Error if nothing is selected after that is done, i wanted to post them back to another page, but dont knwo how to do that. Link to comment https://forums.phpfreaks.com/topic/97919-how-to-post-variables-to-another-form/ Share on other sites More sharing options...
dual_alliance Posted March 26, 2008 Share Posted March 26, 2008 $teamname = GET_("team_name"); $teamcaptain = GET_("team_captain"); $teamphone = GET_("team_number"); $teamemail = GET_("team_address"); to $teamname = $_POST['player_name']; $teamcaptain = $_POST['phone_number']; $teamphone = $_POST['player_email']; $_GET is only used if you are passing variables via a URL e.g. index.php?act=index To refer to this, you would then use $_GET['act']. Link to comment https://forums.phpfreaks.com/topic/97919-how-to-post-variables-to-another-form/#findComment-500966 Share on other sites More sharing options...
jjmusicpro Posted March 26, 2008 Author Share Posted March 26, 2008 so I am having them post the information to another page that takes those values and adds them to my DB, how do i do a redirect after its entered? Link to comment https://forums.phpfreaks.com/topic/97919-how-to-post-variables-to-another-form/#findComment-501223 Share on other sites More sharing options...
jjmusicpro Posted March 26, 2008 Author Share Posted March 26, 2008 so i posted the data, and it was entered into the db fine, however, i wanted to do a redirect after the info is enter to another page, how do i do that? this is all thats in my page i posted to <?php $teamname = $_POST['team_name']; $teamcaptain = $_POST['team_captain']; $teamphone = $_POST['phone_number']; $teamemail = $_POST['email_address']; $db = mysql_connect("localhost", "pump_user","xxxxxx") or die("Could not connect."); // Connection to DB if(!$db) die("no db"); if(!mysql_select_db("pump_db",$db)) die("No database selected."); $acc1="insert into teams (Team_Name,Captain_Name,Team_Email,Team_Phone,Team_Entered) values ('$teamname','$teamcaptain','$teamphone','$teamemail',now())"; $acc2=mysql_query($acc1) or die("Could not enter details."); // Error if nothing is selected ?> Link to comment https://forums.phpfreaks.com/topic/97919-how-to-post-variables-to-another-form/#findComment-501315 Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 <?php header('Location: foo.php'); ?> Link to comment https://forums.phpfreaks.com/topic/97919-how-to-post-variables-to-another-form/#findComment-501317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.