Computing.Net > Forums > Programming > POSTing into MySQL from text boxes

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

POSTing into MySQL from text boxes

Reply to Message Icon

Name: nick.kirby
Date: June 23, 2006 at 16:33:56 Pacific
OS: Winxp
CPU/Ram: 400/1024
Product: Compaq
Comment:

I am trying to use a text box to insert information into an MYSQL db thus:

//insert name and userid
$sql = "INSERT INTO characters (charname, userid) VALUES ('$charname','$userid')";
mysql_query($sql) or die(mysql_error());
?>

I am using this code to insert the simple text info:

echo ('logout');
?>
<?php
$charname = $_POST['$charname'];
?>

<link href="rifts.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/rifts/login/rifts.css">

<html>
<body>
<div id="leftcontent">
<form id="contactform">
<fieldset>
<dl>
<dt><label for="name">Character Name</label></dt>
<dd><input type="text" name="charname" value="" /></dd>

<dt><label for="email">Your Email Address</label></dt>
<dd><input type="text" name="email" value="" /></dd>
</dl>
</fieldset>
</form>

But it simply does not work. I do not know what I am doing wrong, ro why it isn't working. I'm getting really fed up as I cannot see what i am doing wrong. If someone could let me know, point me in the right direction, or, even better, jsut tell me! I'd be very grateful.

Many thanks,
Nick



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: June 23, 2006 at 22:48:57 Pacific
Reply:

OK, not sure if the code above is all from one page or two pages. Please post all of the code in it's entirety. As it is there are some things that don't make sense to me. For example this line:

$charname = $_POST['$charname'];

You don't use that variable anywhere int he code that follows. Are you getting any types of errors?

Michael J


0

Response Number 2
Name: FBI Agent
Date: July 4, 2006 at 21:54:18 Pacific
Reply:

it looks likes you're missing some information... or at least we are (the viewers). if suggest anything it'd be the line

$charname = $_POST['$charname'];

change it to

$charname = $_POST['charname'];

FBI Agent

AIM: EliteAssassin187


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Counting pattern matches ... enter variable in batch f...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: POSTing into MySQL from text boxes

Access Text Box Question www.computing.net/answers/programming/access-text-box-question/5532.html

loading text into a textbox in VB6 www.computing.net/answers/programming/loading-text-into-a-textbox-in-vb6/7729.html

html drop down box and text box www.computing.net/answers/programming/html-drop-down-box-and-text-box/10412.html