I signed up for an early access to the new Bing AI assisted search feature. I received the link the other day and tried it out this morning.
I am pleasantly surprised after some initial experimentation. The search results are easier to digest and are formatted into a very useable short essay format.
As a librarian I am most impressed by the embedded citations included in the answers. I asked a coding question, a first year English Lit and History type of question, two health information questions, and naturally asked Bing to write a short story about a steampunk time traveler.
Part 1 Coding
I asked Bing To write a PHP script to collect a number from a web form and put it in a file,
I would never profess to be a coder, but I can handle this type of thing. The results look like they would work. The pertinent snippets of code were included in the answer, ready to copy and paste. ( There is a handy copy feature build into the result applet.) The cited references all look reliable.
If I had access to a web server I am sure this code would work. Admittedly it is a very simple example. I leave it to an experienced coder to try a more rigorous test.
For my first test I give Bing a pass. Tomorrow the health information questions.
>>>>>>>>>>QUESTION AND BING OUTPUT>>>>>>>>
To write a PHP script to collect a number from a web form and put it in a file, you need to do the following steps:
– Create an HTML form with method=”get” and an input field for the number¹.
– Create a PHP file that receives the number from the form using $_GET superglobal variable¹².
– Open or create a text file using fopen function and write the number to it using fwrite function³.
– Close the file using fclose function.
Here is an example of how your code might look like:
“`php
// HTML form
Enter a number:
// PHP file
<?php
// Get the number from the form
$number = $_GET[“number”];
// Open or create a file named “numbers.txt”
$file = fopen(“numbers.txt”, “a”) or die(“Unable to open file!”);
// Write the number to the file with a newline
fwrite($file, $number . “\n”);
// Close the file
fclose($file);
// Display a confirmation message
echo “The number $number has been saved to numbers.txt”;
?>
“`
Source: Conversation with Bing, 2/23/2023(1) PHP $_GET – W3Schools. https://www.w3schools.com/PHP/php_superglobals_get.asp Accessed 2/23/2023.
(2) How to collect data using php from an HTML form?. https://stackoverflow.com/questions/4426337/how-to-collect-data-using-php-from-an-html-form Accessed 2/23/2023.
(3) Receiving Data from a Form in PHP | HTML Forms and PHP | Peachpit. https://www.peachpit.com/articles/article.aspx?p=672153&seqNum=3 Accessed 2/23/2023.
(4) How to pass form input value to php function – Stack Overflow. https://stackoverflow.com/questions/15055115/how-to-pass-form-input-value-to-php-function Accessed 2/23/2023.
(5) PHP Form Handling – W3Schools. https://www.w3schools.com/php/php_forms.asp Accessed 2/23/2023.
(6) Simple PHP: getting variable from a form input – Stack Overflow. https://stackoverflow.com/questions/21067575/simple-php-getting-variable-from-a-form-input Accessed 2/23/2023.