Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:12:16+00:00 2026-06-11T17:12:16+00:00

I am using a PHP variable on a public web page as: <a href=$user_website>

  • 0

I am using a PHP variable on a public web page as:

<a href="$user_website">

This variable extracts a user’s website address from a mysql database when user inserts his web address into a form in his backoffice. If the user has left the field blank, the dynamic link with the variable in it appears as”

<a href="">

which of course causes the current page to refresh when the link is clicked. I don’t want to create a default link in the mysql database, since I’m already using “http://&#8221; as the default for this field for purposes of prompting the user to enter this before “www.website.com” for proper linking where it will appear in the public web page.

How do I create a default value that will be placed inside the <a href=""> in the event the user leaves this field blank in the form provided for him?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:12:17+00:00Added an answer on June 11, 2026 at 5:12 pm

    Just check if $user_website is empty:

    if (!empty($user_website)) {
        echo "<a href='$user_website'>";
    } else {
        echo "<a href='http://yourdefaultsite.com'>;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello frieds this is how i usually post a variable using Jquery.. $.post(include/save_legatee.inc.php, {
I am trying to create a excel file from Mysql using php. I found
I am using a PHP variable called LeagueLink. When the user is not logged
I'm having trouble using a variable for the directory name in this PHP if
I want the value of JavaScript variable which i could access using PHP. I
I am currently using jQuery to load a variable php layout depending on the
Fairly simple issue which is solved in PHP by using a static variable. private
Using for loop in PHP can we have numbers associate with a variable name?
How to insert multiple rows using variable in Oracle database through PHP? My query-:
I have a PHP function that takes a variable number of arguments (using func_num_args()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.