| Author |
Message |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Mon Aug 02, 2004 12:43 pm |
  |
I want to put a text field bo and I want to be able to take that data to send it to mysql. I know how to do the quiery bit but the how to get the text from the box. thanks |
|
|
    |
 |
Evaders99
Site Admin


Joined: Aug 17, 2003
Posts: 12383
|
Posted:
Mon Aug 02, 2004 7:59 pm |
  |
|
     |
 |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Tue Aug 03, 2004 10:06 am |
  |
I am a complete n00b to all this I have out this and as u prob can see it don't work.
| Quote: |
$var = $_POST['name'];
echo "<form action=\"admin.php\" method=\"post\">
<table border=\"0\">"
."<td><input type=\"text\" name=".name." size=\"30\" maxlength=\"25\"></td></tr>";
echo "</td></tr></table></form>";
|
could u please post like the bit for it to work. I am after about 5 input boxes to be there. Thanks |
|
|
    |
 |
movieman
Lieutenant


Joined: Feb 29, 2004
Posts: 297
Location: New York
|
Posted:
Tue Aug 03, 2004 11:02 am |
  |
your missing a comma in the post part $var = $_POST['name'];
should be $var = $_POST['textfieldname']';, but besides that it is much more involed than that, you need a sql table to start, if you want to add things to a database. |
_________________ http://www.powhost.com
|
|
       |
 |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Tue Aug 03, 2004 11:40 am |
  |
yes I have setup MySql and I have it connecting to the server and selecting the database. I have change the code a bit to get
| Quote: |
define("_NAME","User Name");
define("_NOUSERYET","You are not Regesterd");
define("_HOMEPAGE","Your Websight");
define("_EMAIL","E-Mail");
define("_PASSWORD","Password");
define("_SUBMIT","Submit");
$var = $_POST['textfieldname'];
echo "<center><b>"._NOUSERYET."</b></center><br><br>"
."<form action=\"login.php\" method=\"post\">"
."<table border=\"0\">"
."<tr><td><b>"._NAME.":</b></td><td><input type=\"text\" name=\"name\" size=\"30\" maxlength=\"25\"></td></tr>"
."<tr><td><b>"._HOMEPAGE.":</b></td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"255\" value=\"http://\"></td></tr>"
."<tr><td><b>"._EMAIL.":</b></td><td><input type=\"text\" name=\"email\" size=\"30\" maxlength=\"255\"></td></tr>"
."<tr><td><b>"._PASSWORD.":</b></td><td><input type=\"password\" name=\"pwd\" size=\"11\" maxlength=\"10\"></td></tr>"
."<tr><td><input type=\"hidden\" name=\"fop\" value=\"create_first\">"
."<input type=\"submit\" value=\""._SUBMIT."\">"
."</td></tr></table></form>"; |
When I run this everything works but I get this problem
| Quote: |
Notice: Undefined index: textfieldname in D:\F1racers\login.php on line 13
|
what does this mean |
|
|
    |
 |
bretonmage
Captain


Joined: Feb 21, 2004
Posts: 421
|
Posted:
Tue Aug 03, 2004 12:35 pm |
  |
| Evaders99 wrote: |
Normally it is just
| Code: |
$var = $_POST['textfieldname']';
|
|
That's funny... I've never needed this, the name= part of the text field stores the var fine, so
| Code: |
| <input type=\"text\" name=\"url\" size=\"30\"> |
will store the var $url. |
|
|
   |
 |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Tue Aug 03, 2004 12:41 pm |
  |
when I put that etra ' after the braket I get this error
| Quote: |
Parse error: parse error, unexpected ''' in D:\F1racers\login.php on line 14
|
I have put the name = so that I can adventualy put languege files in |
|
|
    |
 |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Tue Aug 03, 2004 12:43 pm |
  |
damm I get it lol so I don't need that var line I only need to use the textbos name and put a $ infont |
|
|
    |
 |
Evaders99
Site Admin


Joined: Aug 17, 2003
Posts: 12383
|
Posted:
Tue Aug 03, 2004 12:50 pm |
  |
|
     |
 |
Kiss_My_Rifle
Nuke Soldier


Joined: Mar 04, 2003
Posts: 27
|
Posted:
Tue Aug 03, 2004 1:19 pm |
  |
I am really confused now so what do I need to do. if I put , after those brekts like above I get that error above but then if I don't put the var line in when I run
I get this error
| Quote: |
| Notice: Undefined variable: nname in D:\F1racers\login.php on line 31 |
I am confused nothing said to do has worked for me |
|
|
    |
 |
|
|