Jump to content

HOw to post variables to another form


jjmusicpro

Recommended Posts

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
Share on other sites

$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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.