Posted on Sunday 13th May 2007 at 01:14 AM | |
prem Newbie |
ok i user the rmb scripting to make a form and it works fine but when the user data is submitted, it sends the data to a page, but when it sends it there it dont stay there. Is there any way possible that i can get it to stay there? |
Posted on Sunday 13th May 2007 at 01:19 AM | |
ShadowMage Senior Member |
could you show code? might help |
Posted on Sunday 13th May 2007 at 02:36 AM | |
prem Newbie |
tourneyapp.php <html><title>Tourney App</title><center> <body><form action="submitted_data.php" method="post"> <b>Racername:</b><br> <input type="text" name="racername" /><br> <b>Average ET:</b><br> <input type="text" name="averageet" /><br> <b>Car:</b><br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="Integra"/>Integra<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="Lancer"/>Lancer<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="RSX"/>RSX<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="G35"/>G35<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="Mustang"/>Mustang<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="Vette"/>Vette<br> <INPUT TYPE=CHECKBOX NAME="car" VALUE="Ford GT40"/>Ford GT40<br> <b>Which entry amount would you like to pay?</b><br> <INPUT TYPE=CHECKBOX NAME="entry" VALUE="$300"/>$300<br> <INPUT TYPE=CHECKBOX NAME="entry" VALUE="$400"/>$400<br> <input type="Submit" /> </form></body> </html> submitted_data.php <html><title>Submitted Data</title> <body><center>Hello <?php echo $_POST["racername"]; ?>.<br /> You have chose to use a <?php echo $_POST["car"]; ?> for this tourney with the average et of <?php echo $_POST["averageet"]; ?>.<br> With the agreement to pay the entry fee of <?php echo $_POST["entry"]; ?>.<br> Your information has been submitted to our tourney system.<br> Thanks and enjoy the tourney.</body> </html> and this is what you get when you fill out the form: Hello racer. You have chose to use a Integra for this tourney with the average et of 9.7. With the agreement to pay the entry fee of $300. Your information has been submitted to our tourney system. Thanks and enjoy the tourney. but i want it to save the data it submits from the tourneyapp.php onto the page submitted_data.php Like i want it stored there so that way i can have another person access from his computer. But it dont save after you submit the query. Please help. |
Posted on Sunday 13th May 2007 at 05:07 AM | |
SkillMaster Senior Member |
Insert it into a mysql database? if you are prepared to i will make up a code for you. |
Posted on Sunday 13th May 2007 at 01:01 PM | |
prem Newbie |
i really dont want to if its possible, i wanted to store it either everytime someone registered into their own flat text file, or all into one single file all under a folder like user_forms or something like that. |
Posted on Sunday 13th May 2007 at 03:50 PM | |
Diablosblizz Senior Member |
Try putting the $_POST variables in a variable then define them like this: PHP Code
1 2 3 4 5
<?php
|
Posted on Sunday 13th May 2007 at 04:14 PM | |
prem Newbie |
i dont get what you said, explain a little better please. |
Posted on Sunday 13th May 2007 at 04:19 PM | |
Diablosblizz Senior Member |
Alright, ill try. You have the post parts in the middle of your html code. Here: PHP Code
1
<body><center>Hello <?php echo $_POST["racername"]; ?>.
What I am saying to do is this: PHP Code
1 2 3 4 5
<?php
Instead of using the post function all the time just use the variables. This COULD come up something like: Code Hello Diablosblizz I hope you understand, and if im way off what your talking about then sorry. |
Posted on Sunday 13th May 2007 at 06:17 PM | |
prem Newbie |
yes but thats not helping me to do what im needing to do, when a user registers for the tourney then the see the next page with their info they submitted, i want the data they submitted to save into its own text file under a directory called user_forms so that way i can check the forms and see who registered. |
Posted on Sunday 13th May 2007 at 09:30 PM | |
SkillMaster Senior Member |
Code create a new database and user. call the database: tourney call the database user: tourney password: tourney Run this in phpmyadmin Code CREATE TABLE `tourney` ( `id` int(11) NOT NULL auto_increment, `racername` varchar(30) NOT NULL default '', `averageet` varchar(255) NOT NULL default '', `car` varchar(55) NOT NULL default 'Integra', `entry` varchar(40) NOT NULL default '$300', PRIMARY KEY (`id`) ) TYPE=MyISAM; Save this as config.php Code <?php $host = "localhost"; //edit as required $user = "tourney"; //edit as required $pass = "tourney"; //edit as required $db = "tourney"; //edit as required $dbcon = mysql_connect("$host","$user","$pass"); mysql_select_db($db) or die(mysql_error()); ?> Save this as tourney.php Code <?php include ("config.php"); switch($_GET[page]) { default: echo (" <html> <title>Tourney App</title> <body> <form action=\"?page=register\" method=\"post\"> <b>Racername:</b><br><input type=\"text\" name=\"racername\"><br> <b>Average ET:</b><br><input type=\"text\" name=\"averageet\"><br> <b>Car:</b><br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"Integra\"/>Integra<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"Lancer\"/>Lancer<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"RSX\"/>RSX<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"G35\"/>G35<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"Mustang\"/>Mustang<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"Vette\"/>Vette<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"car\" VALUE=\"Ford GT40\"/>Ford GT40<br> <b>Which entry amount would you like to pay?</b><br> <INPUT TYPE=\"CHECKBOX\" NAME=\"entry\" VALUE=\"$300\"/>$300<br> <INPUT TYPE=\"CHECKBOX\" NAME=\"entry\" VALUE=\"$400\"/>$400<br> <input type=\"Submit\" value=\"Register\"/> </form></body> </html> "); break; case 'register': $racername = "$_POST[racername]"; $averageet = "$_POST[averageet]"; $car = "$_POST[car]"; $entry = "$_POST[entry]"; $query = mysql_query("INSERT INTO tourney (racername, averageet, car, entry) VALUES('$racername', '$averageet', '$car', '$entry')"); echo (" <html> <title>Submitted Data</title> <body> <center>Hello $racername.<br> You have chose to use a $car for this tourney with the average et of $averageet.<br> With the agreement to pay the entry fee of <?php echo $entry.<br> Your information has been submitted to our tourney system.<br> Thanks and enjoy the tourney.</body> </html> "); break; } ?> That will insert everything into the database for you to use later on A very big tut |