Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating the usertable with a variable

Status
Not open for further replies.

inteleserve

IS-IT--Management
Dec 13, 2002
75
US
The command below returns a blank box instead of the variable I need. Can anyone help me here?


fullname=request("fullname")


strSQL = "update usertable set fullname = '"& fullname &"' where phone='5073405577'
 
is fullname being passed via a FORM or QueryString?


Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
The fullname is pulled with a query string and displayed in the form for editing. But when I submit, it doesn't update the usertable with the new information. If I have the command:

strSQL = "update usertable set fullname = 'fullname' where phone='5073405577'"


It will update the usertable with 'fullname' But I need it to update with the name JOE SMITH.

 
If you are passing the variable in the querystring use Request.QueryString. If it's a form use Request.Form. It's better to explicitly choose one or the other because it can help avoid confusion.

If your form is using 'GET', the data will be passed in the querystring not the form.

So, i would imagine you need to use:

strSQL = "update usertable set fullname = '" & Request.QueryString("fullname") & "' where phone='5073405577'"

hope this helps

Nick (Webmaster)

info@npfx.com
 
Seems to do the same thing. I'm not sure where to go from here....
 
<td width="13%"><div align="right"><strong>Name: </strong></div></td>
<td>
<% Response.Write ("<input name='fullname' type='text' id='fullname' size='45' maxlength='30' value='"& objrs("fullname")&"'></td>") %>
 
Ok here is a cut down version of what I have. The script that opens the database works now but I think I should put it in another file (opendb.asp). Then call that file.

Then The script on the botton will probably also need to be put in another file (writedb.asp). This is the script I don't know how to write. It will need to open the database and write what i have changed in the page.

I'm not sure how to setup the submit button to open the writedb.asp file for writing either.

Sorry for my lack of knowledge with this I have only been workign with this for a couple weeks.



<%@ Language=VBScript %>
<% OPTION EXPLICIT %>

<% '========================================================

'opendb.asp

Dim objRS, strSQL, Connstr, objConn, fullname, phone


Set objConn = Server.CreateObject ("ADODB.Connection")
Connstr = "Driver=Microsoft Visual Foxpro Driver;" + _
"UID=; SourceType=DBC; SourceDB=C:\inetPub\
objConn.Open Connstr

Set objRS=Server.CreateObject ("ADODB.recordset")
strSQL="select * FROM usertable where phone = '5026548888'"

objRS.Open strSQL, objConn

'======================================================== %>

<html>
<title>Test</title>

<body bgcolor="#CCCCCC" text="#000000">
<form action="form7.asp" method="get">
<p align="center"> <br>Lead Sheet</p>
<table width="100%" border="0">
<tr>
<td height="23" colspan="4"><strong><font size="+1">PERMANENT HOME</font></strong>
</td>
</tr>
<tr>
<td width="13%"><div align="right"><strong>Full Name: </strong></div></td>
<td width="34%"><% Response.Write ("<input name='fullname' type='text' id='fullname' size='45' maxlength='30' value='"& objrs("fullname")&"'></td>") %>
<td width="15%"><div align="right"><strong>Phone: </strong></div></td>
<td width="38%"><% Response.Write ("<input name='phone' type='text' id='phone' size='45' maxlength='10' value='"& objrs("phone")&"'></td>") %>
</tr>
<tr>
<td><input name="submit" type="submit" value="Submit"></td>
</tr>
</table>
<p align="left"><br>
</p>
<br>
<p>
</form>
</body>

<% '========================================================

writedb.asp

fullname = Request.QueryString("fullname")
phone = Request.QueryString("phone")

Set objRS=Server.CreateObject ("ADODB.recordset")
strSQL = "update usertable set fullname = '"& fullname &"' where phone='"5026548888"'"

objRS.Open strSQL, objConn

'======================================================== %>

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top