Page 1 of 1
[SOLVED] Combine 2 Forms with <BR>
Posted: Wed Sep 22, 2004 11:10 pm
by sell-traffic
Hi,
I thought this was straight forward... what am I missing here?
Code: Select all
<?php
GetSQLValueString($_POST['budget'], "text").'<br>'.GetSQLValueString($_POST['domain'], "text");
?>
This should return...
but I get an error "unknown column 'br' in 'field list'" This looks like a dreamweaver error, not php error. I've tried double quotes, single quotes, no quotes, and replacing < with < without success.
Thanks,
Josh
Posted: Thu Sep 23, 2004 12:30 am
by feyd
have you looked at what is actualy returned?
I believe your command will return:
Code: Select all
'budgets value'<br>'domains value'
which is incorrect sql code.
Posted: Thu Sep 23, 2004 11:06 am
by sell-traffic
Ok, I'm trying to get 2 form values and combine them with <br>'s in between them, then take that value and insert it into a field in a mysql database.
I can't check what is returned, because I get an error.
Josh
Posted: Thu Sep 23, 2004 12:02 pm
by feyd
you can't do:
Code: Select all
$check = GetSQLValueString($_POSTї'budget'], "text").'<br>'.GetSQLValueString($_POSTї'domain'], "text");
?
uh ok..
Code: Select all
GetSQLValueString($_POSTї'budget'] . '<br />' . $_POSTї'domain'], 'text');
Posted: Thu Sep 23, 2004 1:12 pm
by sell-traffic
Maybe this will help, here's the full context of the code.
Code: Select all
<?php
$insertSQL = sprintf("INSERT INTO invoices (id, userid, ammount, tax, total, description, status, date_generated, date_due, payment_method, cc_run) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['userid'], "text"),
GetSQLValueString($_POST['amount'], "text"),
GetSQLValueString($_POST['tax'], "text"),
GetSQLValueString($_POST['total'], "text"),
GetSQLValueString($_POST['budget'].'<br />'.$_POST['domain'].'<br />'.$_POST['hosting'].'<br />'.$_POST['design'].'<br />'.$_POST['marketing'].'<br />'.$_POST['comments']),
GetSQLValueString($_POST['status'], "text"),
GetSQLValueString($_POST['datesubmit'], "text"),
GetSQLValueString($_POST['datedue'], "text"),
GetSQLValueString($_POST['paymethod'], "text"),
GetSQLValueString($_POST['ccrun'], "text"));
?>
I get...
Code: Select all
Warning: Missing argument 2 for getsqlvaluestring() in /home/nibuha/public_html/packages2.php on line 3
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ': already have one
domain: already have one
hosting:
The value of the form elements are "budget: 500 and under" or similar. Maybe there is a problem with using colons?
Josh
Posted: Thu Sep 23, 2004 1:42 pm
by feyd
your forgot 'text' on line 8.
Posted: Thu Sep 23, 2004 1:49 pm
by sell-traffic
Ok thanks, now we're getting somewhere... ( I took the ,text out because it wasn't in your example)
Code: Select all
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ': Under 500, 'INQUIRY', '09/23/2004', '09/23/2004', 'chq', NULL
Josh
Posted: Thu Sep 23, 2004 1:53 pm
by feyd
the 'text' is in my example.
as for the error: [php_man]var_export[/php_man] the $insertSQL variable and post it's output.
Posted: Thu Sep 23, 2004 1:57 pm
by sell-traffic
Resolved, I was using ,text after each post, not the line as a whole... Thanks feyd.