Jump to content

[SOLVED] newbie using a default value in php script


henrikb

Recommended Posts

Hi,

 

I like to my members to be able to include audio and video on their profile page.

 

The EDIT PROFILE page has the following code where the member can enter the audio/video info:

 

$audio = "<textarea name='audio' class='text' cols='45' rows='3'>".stripslashes($row["cAudio"])."</textarea>";

 

$video = "<textarea name='video' class='text' cols='45' rows='3'>".stripslashes($row["cVideo"])."</textarea>";

 

My question is, I like to have a default audio and video file which are used if the member do not change the default values above, how to I do that?

 

Appreciate your help!

 

Henrik

You could create a field in the database, something like: video_selected. If they change the video put a 1 as the value, if not, leave it as 0. Then base the code off the value from the field in the database.

 

Edit: if your storing the source of the video in the database, just check to see if it's not the default value with an if/else statment:

 

if (stripslashes($row["cAudio"]) == "default value)
{
    //default code
} else {
    //other code
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.