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

Link to comment
Share on other sites

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
}

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.