close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two inputs into one DB field

Thread began 8/01/2011 11:50 am by paul386190 | Last modified 8/06/2011 10:00 am by paul386190 | 800 views | 4 replies |

paul386190

Two inputs into one DB field

Hi there

I have a form created within DA and two of the fields capture a person's first name and last name. These go into their own respective 'first_name' and 'last_name' fields in the database, but i would also like these inputs to go both together into one extra field called 'full_name', separated by a '-'. So if 'John' is entered into 'first_name' and 'Smith' entered into 'last_name' I would like 'John-Smith' to go into the 'full_name' field.
Any advice would be greatly appreciated.

Many thanks in advance
Paul

Sign in to reply to this post

Jason ByrnesWebAssist

I dont see a good reason to store the information to a new field, instead of storing to a new field, you can out put the existing fields to your page to display the data in the format you wish:

<?php echo $row_recordsetName['first_name']; ?>-<?php echo $row_recordsetName['last_name']; ?>

Sign in to reply to this post

paul386190

Hi Jason, thank you for your reply.

The reason I'm collecting them together in a second field is that this is being used within the URL of the page for SEO purposes ie. 'index.php?full_name=John-Smith' and then stripping this part of the URL down to just 'John-Smith' via mod rewrite.

Many thanks
Paul

Sign in to reply to this post

Jason ByrnesWebAssist

you still dont need to store it in a new column, in the sql for the recordset, you can use the CONCAT() function to create the full_name column dynamically at run time.

SELECT CONCAT(first_name, '-', last_name) AS full_name FROM users

Sign in to reply to this post

paul386190

Hi Jason, apologies for the delay in my response - been away from the mac for a few days.
Many thanks for your advice, really appreciate it. Have to admit it's not something I've done before so the route I was looking at was just the initial solution I'd thought of.

I'll give it a try and see how I get on. Many thanks again.
Kind regards
Paul

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...