Hoe can i get the below $_GET variables into fpdf
//User Details
$Name = $_GET['name'];
$Surname = $_GET['surname'];
$City = $_GET['city'];
$CountryCode = $_GET['countrycode'];
$Phone = $_GET['phone'];
$Email = $_GET['email'];
<?php
include('includes/fpdf.php');
$Name = $_GET['name'];
$Surname = $_GET['surname'];
$City = $_GET['city'];
$CountryCode = $_GET['countrycode'];
$Phone = $_GET['phone'];
$Email = $_GET['email'];
class PDF extends FPDF
{
// Page header
function Header()
{
I need to create a pdf after a form submission and let the user print the file.
I'm not familiar with fpdf at all but in your class methods you would do something like
$pdf = new PDF();
$pdf->someMethod($Name);
Which would pass you $Name variable into that method
include('includes/fpdf.php');
public $Name = "";
class PDF extends FPDF
{
function XYZ()
{
$this->Name = $_GET["name"];
}
}
This is the way of receiving the data in a class. But its more better if
you read the fpdf documentation, in which you can get more information
about generating the pdf.
The FPDF API seems to be an entire library of functions and features.
Writing how to use all the functions here would be a waste of time, so please find documentation of FPDF in other locations.
Here is the first link I found that appears to be fruitful:
Generating PDF files with PHP and FPDF
Related
I have several values in cloud firestore and want to access every variables. Hence I do my code like this
<?php
require __DIR__.'/vendor/autoload.php';
use Google\Cloud\Firestore\FirestoreClient;
$db = new FirestoreClient(
[
'projectId' => 'fakedata-aa798'
]
);
$collectionReference = $db->collection('Test3');
$docRef = $collectionReference->document('User1');
$snapshot = $docRef->snapshot();
$Name= $snapshot['Name'];
$Contact= $snapshot['Contact no:'];
$Email= $snapshot['Email'];
$Location= $snapshot['Location'];
$Locationstatus= $snapshot['Location status'];
$Condition= $snapshot['Condition'];
session_start();
$_SESSION['Name'] = $Name;
$_SESSION['Contact no:'] = $Contact;
$_SESSION['Email'] = $Email;
$_SESSION['Location'] = $Location;
$_SESSION['Location status'] = $Locationstatus;
$_SESSION['Condition'] = $Condition;
?>
Now I want to display the values in next PHP files and I use session_start but still can't get the values
pages2
<?php
session_start();
echo $_SESSION['Name'];
?>
Can someone help me?
I am developing an API and I want to send some PHP variables with the posted data through to the API. So far this is how it's working:
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$cardNumber = $_POST['order_payment_number'];
$oldExpirationDate = $_POST['order_payment_expire_month'] . $_POST['order_payment_expire_year'];
$date = date('m/d/Y', strtotime('+01 months'));
$expirationDate = substr($oldExpirationDate, 2);
When I actually place these variables inside of functions though, the code breaks. Example:
$subscription->setName("Sample Name"); //sends to API perfectly
$subscription->setName($firstName); //Hits an error, does not submit
However when I echo the variables, they print just fine.
echo $firstName; //returns stored data in $_POST['first_name'];
How to make an automatic code generator so that I can send it to a mobile using my API then verify it after checking in php codeigniter
My one related controller looks like:
public function print_patientdetails($id,$veri,$phone,$username) {
if($veri == 0){
$verifycode = "12345"; // here I need an automatic code generator function
$result['verifycode'] = "12345";//and here need to keep the code and pass hidden throughout the pages
echo $this->sendverifymsg($phone, $verifycode);
$result['query'] = $this->panel_model->hospitaldetails($sess_id);
$result['query1'] = $this->register_model->view_register($phone, $username);
$this->load->view('innerheader', $result);
$this->load->view('verify', $result);
$this->load->view('footer', $result);
}else{
$sess_id = $this->session->userdata('id');
$result['query'] = $this->panel_model->hospitaldetails($sess_id);
$result['query1'] = $this->register_model->edit_patient($id);
foreach ($result['query1'] as $row)
{
$phone = $row->phone;
$username = $row->userid;
$email = $row->email;
$this->load->view('print_patientdetail', $result);
echo $this->sendregistermsg($phone, $username);
echo $this->mail($email, $phone, $username);
}
}
}
Just use php uniqid() native function like this:
$verifycode = uniqid();
what i understood is you just need something which can generate a random code for you.
if this is purpose you can use rand(0,99999); function which generates random numbers.
Moreover if you need that this random number should not b one from already generated then you can use db to store random numbers, enter it when it generates and at the time of new generating compare it with already stored random numbers.
i wrote a relatively simple but usable php query logging software a couple of years back and my setup was "plain vanilla" where a form, with a POST method has a separate page that processes the form like below
1) input form displays with a submit button that calls process-form.php
2) process-form.php then processes the form (e.g. enters the data onto a database)
3) process-form.php displays a message if everything is fine or not.
now, when i go through some php tutorials, they are teaching having the form submit upon itself by using $_SERVER
<?php
//use the $_SERVER function to decipher if the POST method has been triggered
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
//TODO: Send email, etc.
}
?>
i can see the benefits of of this method as the code remains compact as you just have to go to 1 page only instead of going to other pages if you need to fix something. Is this the prevalent method now? just asking as i am trying to learn. thank you!
You can use isset() or sizeof() or empty()
if (isset($_POST))
{
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
//TODO: Send email, etc.
}
OR
if (sizeof($_POST) > 0)
{
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
//TODO: Send email, etc.
}
OR
if (!empty($_POST))
{
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
//TODO: Send email, etc.
}
I am a beginner in Joomla, I want to integrate Facebook login with my website (using Joomla 3.0), I want to know how to store the user info into my database after receiving them from facebook. Any suggestion?
Try this,
If you are using FB SDK for PHP
$path = realpath('.');
require_once($path."/facebook/fbmain.php");
$user = $facebook->getUser();
// print_r($user);
// echo "user<br/>";
// print_r($userInfo);
// echo "<br/>Info<br/>";
// print_r($fqlResult);
// foreach($fqlResult as $key=>$value){
// print_r($value);
// echo '<br>';
// }
// exit;
if ($user){
$fname = $userInfo['first_name'];
$last_name = $userInfo['last_name'];
$username = $userInfo['id'];
$dob = date("d-m-Y",strtotime($userInfo['birthday']));
foreach($fqlResult as $key=>$value);
$user_email = $value['email'];
$profile_image = $value['pic_square'];
$sex = $value['sex'];
$city = $value['hometown_location']['city'];
$state = $value['hometown_location']['state'];
$country = $value['hometown_location']['country'];
$zip = $value['hometown_location']['zip'];
//Then simply call model and write save db query.
$model = $this->getModel('Registration', 'UsersModel');
}
You want to make a FB authentication plugin and then have that pass off the data to the Joomla user plugin if possible. If you want to use a different user table you would need to make your own user plugin as well. Joomla auth first authenticates (authentication plugin), then authorsises, then logs in (user plugin)