Jump to content

avoiding empty input


WesleyA

Recommended Posts

Hi there

 

I need to avoid empty input whlie using checkdnsrr A

 

I made a function called empty_char but it doesnt work.

 

the purpose of empty_char is to have an empty input being replaced by an x.

 

But something is not good so I can use some help.

 

Why isnt the value after using empty_char transmitted to the checkdnsrr part?

 

I show you my test set up as an example:

    <html><center><br><br>
    <form>
    <input type="text" name="webadres" > <br>
    <input type="submit" value="send"><br><br><br>
        </form>

     <?php
	        if ($_SERVER['REQUEST_METHOD'] === 'GET') 	{ 
		
				if (isset($_GET['webadres'])){ 
    
					echo 'this is your input : ';
						echo $_GET['webadres'];

    echo "<br><br>";

    $_GET['webadres'] = empty_char($_GET['webadres']);

    echo '<br><br><br>input after empty_var filter to avoid empty input : ' . $_GET['webadres'];

    $recordexists2 = checkdnsrr($_GET['webadres'], "A");
    if ($recordexists2) {
     echo $_GET['webadres'] . "<br><br>is an existing domain and topleveldomain <br>";
     }
     else
     {
		echo $_GET['webadres']; 
        echo '<br>please type in a valid domain ... <br> so onlythe domain and tld but no subdomain      <br><br>';
       }

     }
			}

	
	
	function empty_char($url)
                           { 
     if ($url == '' ) 
     {
	$url=='x';
    } 
    else 
    { $url == $url; 

     }
     echo 'function output of the var_dump $url : ';
     var_dump($url);
						   }
	
     ?>
    </center>
    </html>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...