Welcome to the Webmaster Forum.
Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jan 2014
    Location
    Banglore
    Posts
    289

    Writing a Script to Retrieve the Data

    The code for hiUser.php expects to be run from whatsName.html. The form that called the hiUser.php code is expected to have an element called userName. Take a look at the code for hiUser.php and see what I mean.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Hi User</title>
    </head>
    <body>
    <h1>Hi User</h1>
    <h3>PHP program that receives a value from "whatsName"</h3>
    <?php
    $userName = filter_input(INPUT_GET, "userName");
    print "<h3>Hi there, $userName!</h3>";
    ?>
    </body>
    </html>
    Like many PHP pages, hiUser.php is mainly HTML. The only thing that’s different is the two new lines of code. One creates a variable called $userName, and the other uses that variable in a print statement.

    The first line extracts the user name from the previous form. When the form is sent to the server, all the form data is passed to the server, which can extract the data. The filter_input() function is one way to retrieve that data.

    When you call filter_input(), you need at least two parameters. The first indicates where PHP should look for the data. INPUT_GET is a predefined value, meaning the data was sent through the GET mechanism. (Of course, you can also use INPUT_POST if that’s how the data was sent.) he second parameter is the name of the value. It corresponds to the name attribute in the previous form. In this case, the form had one input element named “userName.” The value of that text field is now extracted and stored into a PHP variable named $userName. Almost all PHP and HTML interactions work this way; you build an HTML form with a bunch of input elements, and write PHP code to extract those elements into variables.

  2. #2
    Senior Member
    Join Date
    Jan 2015
    Posts
    567

    Re: Writing a Script to Retrieve the Data

    Very nice information thanks for sharing.

  3. #3
    Senior Member
    Join Date
    Sep 2018
    Posts
    242

    Re: Writing a Script to Retrieve the Data

    To add text to files, we’re going to use a text editor called Nano. We’re going to create a file to take notes about what we’ve been doing with the data files in ~/shell_data/untrimmed_fastq.
    This is good practice when working in bioinformatics. We can create a file called README.txt that describes the data files in the directory or documents how the files in that directory were generated. As the name suggests, it’s a file that we or others should read to understand the information in that directory.


    Indian Astrologer in Canada | Indian Astrologer in Toronto | Best Indian Astrologer in Canada | Top Indian Astrologer in Toronto

 

 

Similar Threads

  1. Article Writing
    By kilato in forum General Talk
    Replies: 17
    Last Post: 02-02-2020, 10:49 PM
  2. Press release Writing
    By infilead in forum Search Engine Optimization (SEO)
    Replies: 14
    Last Post: 12-14-2019, 09:30 PM
  3. Replies: 0
    Last Post: 08-28-2014, 01:52 AM
  4. Writing a Diary ?
    By kilato in forum General Talk
    Replies: 1
    Last Post: 05-02-2014, 04:46 AM
  5. retrieve data?
    By preetisoft2 in forum PHP
    Replies: 0
    Last Post: 05-15-2013, 01:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Back to top

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203