Hi hope you can help with this.

Fields have spaces in the fields being echoed, how would I use the replace to change those spaces to a dash.

'Make' field will be something like blar blar blar and I need it to be blar-blar-blar

<h4><a href="">'. $row['Make'].'</a></h4>
Hope you can help. Thanks

Member Avatar for LastMitch

@mpc123

'Make' field will be something like blar blar blar and I need it to be blar-blar-blar

Try this:

$string = preg_replace("/[\s_]/", "-", $string);

to make the dash appear

thanks for the reply and sorry to sound totally thick but where / how would I use it?

Member Avatar for LastMitch

@mpc123

This is the code where the words have blar-blar-blar? Am I right?

$row['Make']

You missing full code that is related to the $row['Make']

To add this:

$string = preg_replace("/[\s_]/", "-", $string);

This code needs to be part of your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.