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. Quote Link to comment 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']. Quote Link to comment 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? Quote Link to comment 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 ?> Quote Link to comment Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 <?php header('Location: foo.php'); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.