To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Tools > Dreamweaver

Dreamweaver In need of help with Dreamweaver?

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-09-2003, 12:53 PM   #1
jarow
Member
 
Join Date: Jan 2003
Posts: 44
can 2 form fields have same name and send data to same db field?

I need to create 3 separate text fields, the contents of which all need to be sent to one field in my mysql database...any ideas on how I may accomplish this in dreamweaver mx? and how I get the mysql database to accept three values?

Many thanks

Jim
jarow is offline   Reply With Quote
Old 02-10-2003, 05:10 PM   #2
autocolismo
Senior Member
 
autocolismo's Avatar
 
Join Date: Sep 2002
Location: Portugal
Posts: 174
$value_to_mysql = $_GET['textfield1'] . $_GET['textfield2'] . $_GET['textfield3'];

then

insert into your_table set value = '$value_to_mysql';
__________________
..:oOOoo::..
autocolismo is offline   Reply With Quote
Old 02-11-2003, 05:11 AM   #3
Jim_Madrid
Member
 
Join Date: Feb 2003
Posts: 41
Thank you for your response. I understand the concept but I am having trouble incorporating it into the Dreamweaver INSERT RECORD syntax. Let´s say I have the following code for:

Database table: session database field = animals
Form Textfield1 = animals

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO session (animals) VALUES (%s)",
GetSQLValueString($HTTP_POST_VARS['animals'], "text"));

mysql_select_db($database_conntest, $conntest);
$Result1 = mysql_query($insertSQL, $conntest) or die(mysql_error());
}

Now, if I have two more form textfields that I want to insert into one database field I imagine I would have to create something like this:

$habitat=$_GET[‘habitat1’] . =$_GET[‘habitat2’]
INSERT INTO session (habitat) VALUES ('$habitat’)

How and where do I put this exactly ?

Again thanks for your reply.

Jim
Jim_Madrid is offline   Reply With Quote
Old 02-11-2003, 05:26 AM   #4
autocolismo
Senior Member
 
autocolismo's Avatar
 
Join Date: Sep 2002
Location: Portugal
Posts: 174
PHP Code:
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset(
$HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset(
$HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {


$habitat = $_POST['habitat1'] . $_POST['habitat2'] . $_POST['habitat3'];

$insertSQL = sprintf("INSERT INTO session set animals='$habitat'";

mysql_select_db($database_conntest, $conntest);
$Result1 = mysql_query($insertSQL, $conntest) or die(mysql_error());
}
I think this workx fine
__________________
..:oOOoo::..
autocolismo is offline   Reply With Quote
Old 02-12-2003, 04:15 AM   #5
Jim_Madrid
Member
 
Join Date: Feb 2003
Posts: 41
muito obrigado....it works like a charm
Jim_Madrid is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 10:30 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.