Jump to content

Insert Two Inputs Into One Column


kool_samule

Recommended Posts

Hi Chaps,

 

Maybe a simple answer to this one, I have two input fields, which I want to combine into 1 SQL column.

 

Inputs:

<input type="text" name="job_no" value="00001" size="32" />
<input type="text" name="job_model" value="MODEL_A" size="32" />

 

SQL:

"INSERT INTO tbl_job (job_title) VALUES (%s)", GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text");

 

This produces:

job_title = 00001' - MODEL_A

 

Problem:

Notice the character after the job_no. . . .how do I get rid of this?

Link to comment
Share on other sites

Ok well you have a few options:

 

[a]

Drop dreamweaver and code like a pro - so you can know your code (you typed it all) or you will have serious issues later on.

 

Get rid of that single quote with str_replace(), or substr(). (This is lazy).

 

[c] * Reccomended

Fix the code thats adding that to it for some reason.

 

I reccommend C because it will prbably benefit you the most. To do this:

 

First debug the values, put this before the query.

echo(GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text"));

 

If it is correct, then you need to find out whats going on in that dreamweaver function.. or better yet write your own.

 

If it is wrong, then somewhere up is the error, maybe from the previous page, you can check post values at the start to check they are what they are expected to be.

 

-CB-

Link to comment
Share on other sites

I personally use Notepad++, for these reasons:

 

1. Can be downloaded in seconds, small file.

2. Low Resource Footprint (Loads on computer fast).

3. Multiple language support, programming and dialects.

4. Activaly maintained and updated.

5. Decent Syntax highlighting for Most Languages.

6. Moddable, Extensible and overall more versatile.

7. Free

8. Its just a decent program, decent features, multi search replace, everything you need. and it remembers what you had open etc its just perfect for single projects.

 

-CB-

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.