Form objet use to get information from people - Forum

Forum Navigation
You need to log in to create posts and topics.

Form objet use to get information from people

Hello Luis ...

I looked in the "help" about VisualNeo Web and the "Form" object proposes to be used to obtain information from a person or a client.

How do we do that?

Where do we find the Server script "myscript.php" and how to use it with the "Form" object to get the information of the person.

I understand that the script "myscript.php" must be placed on the Host web server.

Roger

Where do we find the Server script "myscript.php" and how to use it with the "Form" object to get the information of the person.

Hi @rocote, that script should be coded by you, depending on what information and how you want to store or send the information, the script could be quite different. This is a sample code for sending the form data through email:

<?php
//Header required when app and php are of different origins
header("Access-Control-Allow-Origin: *");
$message="";
if($_SERVER["REQUEST_METHOD"] === "POST") {
   foreach ($_POST as $key => $value){
      $message .= "".htmlspecialchars($key).": ".htmlspecialchars($value)."\r\n";
   }
   $to = "somebody@example.com";
   $subject = "My subject";
   $headers = "From: webmaster@example.com" . "\r\n" . "CC: somebodyelse@example.com";
   mail($to,$subject,$message,$headers);
}else{
   $result = "INVALID DATA";
   echo $result;
}
echo "EMAIL SUCCESSFULLY SEND";
?>

Just change $to, $subject and $headers variables and save it into a text file with name "myscript.php". Then upload it to your web server. Also use something like this on your form action property:

https://yourdomain.com/yourfolder/senddata.php

Regards.

Vadim has reacted to this post.
Vadim

This script works very well, I tested it during my tests of the different functions of visualneo web, while waiting to be able to put everything in practice in a real project.