Jump to content

WesleyA

Members
  • Posts

    172
  • Joined

  • Last visited

Posts posted by WesleyA

  1. 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>
    
  2. About as clear as tax evading starbucks coffee, so you don't want to supply code for rcell because it never changes, but you want to know if rcell can be changed with php or javascript on onload event? Is what i just read :-s

     

    To speak the truth: I dont have any code for rcell.

  3. I was thinking about using javascript onLoad. I think it will work, but I would like to know if PHP also offers a solution to make a page load and call it from another page.

     

    It is not easy to give an exact script, because there might be more solutions. It could be the solution is html or javascript, but I hope for PHP.

     

    So is it possible to do onLoad and target a page in a specific frame with PHP?

  4. I think it isnt necesssary to show that with code. It are just pages.

     

    Like when I click on home the lcell is targeted. So there the page changes.

     

    The rcell remains the same.

     

    I would like to change it automatically. Is there an html element or attribute to change it? Can I use PHP? Or do I have to use javascript, like onLoad?

     

    Please I would like to know that I'm not sure what language and code to choose.

  5. That doesnt work for me. I can choose one of the menu options but then I only choose the value in the name attribute: lcell. The rcell doesnt change automatically.

     

    How is this done?

     

    With html or PHP?

     

    I would like to find some answers to this.

  6. Hi,

     

    I'm making a menu script with several options. With ul and li.

     

    The script works but I cant find a way to have a start up page or so selected. What happens now is that the last chosen page is showing in the browser unless < a href "somepage"> is used and targeted in the obtained name attribute.

        <ul class="slideuptabs">
        <li><a href="http://localhost/MyLocation/home.php"  target="lcell"><span>Home</span></a></li>
        <li><a href="http://localhost/MyLocation/home2.php" target="lcell"><span>Home2</span></a></li>
        <li><a href="http://localhost/MyLocation/home3.php" target="lcell"><span>Home3</span></a></li>     
        <li><a href="http://localhost/MyLocation/home4.php" target="lcell"><span>Home4</span></a></li>   
      <li><a href="http://localhost/MyLocation/home5.php" target="lcell"><span>Home5</span></a></li>    
     <li><a href="http://localhost/MyLocation/home6.php" target="lcell"><span>Home6</span></a></li>     </ul>
         <br><br>
         <table  class = "maincell" border="2" cellpadding="2" cellspacing="2">
         <tbody>
         <tr>
          <td class="lcell" name ="lcell"><iframe src=" " name="lcell" width="99%" height="99%" framebo       rder="0"> </iframe>
          </td>
          <td class="rcell" name ="rcell"><iframe src=" " name="rcell" width="99%" height="99%" framebo       rder="0"> </iframe><br>
           </td>
         </tr>
          </tbody>
          </table>
    

    Is there a solution do this at loading the site or frame page?

     

    Can it be done in html or should I use another language? .

  7. too bad. The thing is I'm no expert at css. Actually I'm like totally unintelligent.

     

    But the positive thing is that I'm willing to learn.

     

    I have a lot of questions. Dozens!

     

    for anybody who likes to answer questions please ... is it possible to use position relative and overflow in a way that the lower text moves downwards?

  8. If only that was valid html passed by html validator, I might! Have considered helping.

     

    I'm not sure if my code is correct, but this principle worked for me.

     

    I'm looking for a way to create text containers that pad down the rest of the page.

     

    How is a parent child element created then in html? And how is it done in css?

  9. Sorry I didnt post the code yet.

     

    I solved the problem above by making divs around the spans and set the position.

     

    But actually I think I can simplify my script.

     

    I give an example, imagine you have a div and a span inside like this:

        <htmL>
         <div class='pos1'>
          <span class = 'con1'>
          <div class= 'pos2'>
           <span class = 'con2'>
         </span>
          </span>
         </div>
         </div>
    
    
    
        </html>
    

    this is basically how i installed a parent child block where con1 is the parent and can2 the child. For simple html this works, but now, while I'm going to loop it, it has its limitations, so I would like to set it all in css.

     

    Is there a parent property or can you set the selectors in the css script?

  10. I have a question about margin-top.

     

    I made a css script with span columns. The higher columns are supposed to push the lower ones down. I place them in a div, in here multiple columns.

     

    The second column though, takes the top of the outer div as reference (not sure if that tis called parent). I find this strange. I tried to make a second div inside but it didnt work.

     

    Can you only use div as a reference point or also a span element or p ?

  11. I will give an example. The code is a loop, but it doesn't grab the column from the css style sheet.

        <?php for ($i = 1; $i <= 4 ; $i++ ) { 
        $var = $i;
        var_dump($var)
         ?>
    
        <span class="<?php $var; ?>"  >
    
        </span>
    
         <?php  } ?>
    

    changing $var in to something else or renaming the css classes does also not seem to work.

     

    is the code as used above good? I'm not sure how to embed php in html attributes, what are the rules?

  12. I tried to use array_slice.

     

    It works, but not for loops.

     

    is there a way to loop through the array offset number?

     

    this is a part of the function I wrote:

        $sql = "SELECT name FROM $var";
    
        if (!$result = $conn->query($sql)){
    	die('There was an error running the query[' .$conn->error. ']');	
        } 
    
        $result = $conn->query($sql);
    
        if ($result->num_rows > 0){
    
         
        while($row = $result->fetch_assoc()){
    	
             $name = $row["name"]; 
     
    		$testrow[] = explode(' ' , $name);
    	  $slice[] = array_slice($testrow, 0 , 1); 
            // 0 is the $offset but can be a number from 1 until n related to size of the table
    	 //	var_dump($offset);
    	
    	// var_dump($slice);
    
    	 $name = implode(" ", $slice[0]);	
    
             var_dump($name);
    

    Is array_slice the right method or is there another way to loop through an array?

  13. Beside the example above; I have a script that accepts the values of a test array but this array has keys.

     

     

    For the part obtained code is retrieved from the database with mysql. This is done with a while loop.

     

    But this is a string.

     

    So I used explode to make an array. But explode makes different arrays, because all key values seem to have 0.

     

    How can I make an array with explode that has key values starting with 0 to value n ?

  14. Down here the code to call a function it works with list. I dont understand how list works, In my example list gives a survey of 2 arrays that are executed inside the function

     

    here is how I call the function:

          $row = list ($variable, $number) = my_function();
          var_dump($row);
    

    the output is like this:

     

     

    array (size=2)
    0 =>
    array (size=8)
    0 => string 'Apple' (length=5)
    1 => string 'Peach' (length=5)
    2 => string 'Cherry' (length=6)
    3 => string 'Grape' (length=5)
    4 => string 'Blueberry' (length=9)
    5 => string 'Lemon' (length=5)
    6 => string 'Mango' (length=5)
    7 => string 'Banana' (length=6)
    1 =>
    array (size=8)
    0 => string '1' (length=1)
    1 => string '2' (length=1)
    2 => string '3' (length=1)
    3 => string '4' (length=1)
    4 => string '5' (length=1)
    5 => string '6' (length=1)
    6 => string '7' (length=1)

     

    7 => string '8' (length=1)

     

    I need the values separated but how can I list the second array (the one with the numbers) as single numbers outside an own function?

  15. I have a piece of code where I use MYSQL to add records into a database. Here I use INSERT, but I want to work with UPDATE.

     

    The user selects records which have to be updated. The records have a unique number.

     

    I hope people can help me how to convert MYSQL code into PHP.

     

    The MYSQL code used in the console is this:

        UPDATE table_name SET input2='my input here ' WHERE rec_number = 2;
    

    The part of the script I use looks like this:

        <?php 
    
        $name1 = $conn->real_escape_string($input1);
        $name2 = $conn->real_escape_string($input2);
    						
    							// $sql = "INSERT INTO $table (input1, input2    ) VALUES (' $name1 ', ' $name2 ')" ; // olde code
    							//   $sql = "UPDATE $table SET input2, input1     WHERE rec_number = $rec_number_selected VALUES (' $name1 ', ' $name2 ')" ;
    							 $sql = "UPDATE $table (input1, input2) VALUE    S (' $name1 ', ' $name2 ') WHERE rec_number = $rec_number_selected " ; 
    							 
    	?>
    

    Anyone any idea what the right code is in PHP?

×
×
  • Create New...