Jump to content

have strings in documents


searls03

Recommended Posts

You could have a link to a PHP file which would generate the PDF.

 

Say you had a file with this in it:

 

<?php

//FPDF code
require_once 'fpdf.php';

$user = $_GET['name'];

$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello ' . $user);
$pdf->Output();

?>

 

It would create a PDF document saying Hello to whatever name you put in the query string.

Link to comment
Share on other sites

FPDF manual should help,

 

According to it you change:

$pdf->Cell(40,10,'Hello ' . $user);

 

to:

$pdf->Cell(80,10,'Hello ' . $user, 1);

 

the 4th parameter is if to have a border around the text so setting it to 1 will make a border.

Link to comment
Share on other sites

ok, so I am trying to make it echo $name, but it doesn't seem to be working:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['id'])) { 
   echo 'Please <a href="login.php">log in</a> to access your account';
   exit(); 
}
//Connect to the database through our include 
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$name = $row['name'];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}
$name1 =  '$name';
require('fpdf.php');

class PDF extends FPDF
{
//Page header
function Header()
{
    //Logo
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(70);
    //Title
    $this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C);
    //Line break
    $this->Ln(20);
$this->Cell(0,0,'',1,0);
$this->Ln(20);
$this->cell(100,20, 'Registrant:', 1,0);
$this->cell(10,20, $name1, 1,0);
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',;
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->Output();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

 

And yes, the session id isset..................how can I make it pull it from the previous page where the link is?  do you know......I can't seem to find this on the site?

Link to comment
Share on other sites

$name1 doesn't exist in the scope of the header function. You would need to either add it as a parameter (preferred) or add global $name1; to the top of the function.

 

For more information see: http://php.net/manual/en/language.variables.scope.php

 

<?php
class PDF extends FPDF
{
//Page header
function Header()
{
	global $name1; // get the variable $name1 into the scope of this function



	//Logo
	//Arial bold 15
	$this->SetFont('Arial','B',15);
		//Move to the right
	$this->Cell(70);
		//Title
	$this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C);
	//Line break
	$this->Ln(20);
	$this->Cell(0,0,'',1,0);
	$this->Ln(20);
	$this->cell(100,20, 'Registrant:', 1,0);
	$this->cell(10,20, $name1, 1,0);
}

//Page footer
function Footer()
{
	//Position at 1.5 cm from bottom
	$this->SetY(-15);
	//Arial italic 8
	$this->SetFont('Arial','B',;
	//Page number
	$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
$pdf->Output();
die(); // Stop execution, don't want to load that HTML in a PDF document it would most likely corrupt it.
?>

Link to comment
Share on other sites

ok, so i have looked at the manual and cant seem to find how I would echo an addition function that was executed and how I can apply this to the page:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['id'])) { 
   echo 'Please <a href="login.php">log in</a> to access your account';
   exit(); 
}
//Connect to the database through our include 
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$name = $row['name'];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}
$name1 =  '$name';
require('fpdf.php');

class PDF extends FPDF
{
//Page header
function Header()
{

	global $name;
	global $total;
	 // get the variable $name1 into the scope of this function
    //Logo
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(70);
    //Title
    $this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C);
    //Line break
    $this->Ln(20);
$this->Cell(0,0,'',1,0);
$this->Ln(20);
$this->cell(50,10, 'Registrant:', 1,0);
$this->cell(50,10, 'Events:', 1,0);
$this->cell(50,10, 'Price:', 1,0);
$this->Ln(10);
$this->cell(50,10,$name, 1,0);
$this->cell(50,10, $events, 1,0);
$this->cell(50,10, $total, 1,0);
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',;
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->Output('ticket.pdf', 'I');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

 

here is the $total:(from previous page)

$total = $price1 + $price2 + $price3 + $price4 +$price5 + $price6 + $price7 + $price8;

 

and here is what I want for $events(from previous page):

 <?php
      $sql = ("SELECT * FROM Events WHERE eventid='$eventid' && userid='$userid'");
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$event = $row['event'];
$startdate = $row['startdate'];
$enddate = $row['enddate'];
$description = $row['description'];
$location = $row['location'];
$subevent1 = $row['subevent1'];
$subevent1 = $row['subevent2'];
$subevent3 = $row['subevent3'];
$subevent4 = $row['subevent4'];
$subevent5 = $row['subevent5'];
$subevent6 = $row['subevent6'];
$subevent7 = $row['subevent7'];
$subevent8 = $row['subevent8'];
}

if (!empty($title1)) { echo  "<br/>$title1"; }
if (!empty($title2)) { echo  "<hr><br/>$title2" ; }
if (!empty($title3)) { echo  "<hr><br/>$title3"; }
if (!empty($title4)) { echo  "<hr><br/>$title4"; }
if (!empty($title5)) { echo  "<hr><br/>$title5"; }
if (!empty($title6)) { echo  "<hr> <br/>$title6"; }
if (!empty($title7)) { echo  "<hr><br/>$title7"; }
if (!empty($title8)) { echo  "<hr><br/>$title8"; }
?> 

 

can you help me with this?  I am not good with the strings from previous pages.................

Link to comment
Share on other sites

Why not have the code work out the total on the page with the PDF instead of the last one.

 

If you need to do it on both then you will need to use the same code as the last page to calculate the total (maybe put the code into a function and call that from both pages). Alternatively you could store the total in the users session like you have their ID and then on the next page fetch it from the session or if it doesn't matter that they can change it, put the total it in the query string and get it from there.

Link to comment
Share on other sites

ok, so for the total I have:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['id'])) { 
   echo 'Please <a href="login.php">log in</a> to access your account';
   exit(); 
}
//Connect to the database through our include 
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$name = $row['name'];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}

$sql = mysql_query("SELECT * FROM Events WHERE userid='$userid' && eventid='$eventid'");
while($row = mysql_fetch_array($sql)){
$price1 = $row['price1'];
$price2 = $row["price2"];
$price3 = $row["price3"];
$price4 = $row["price4"];
$price5 = $row["price5"];
$price6 = $row["price6"];
$price7 = $row["price7"];
$price8 = $row["price8"];

}
$total = $price1 + $price2 + $price3 + $price4 +$price5 + $price6 + $price7 + $price8;
require('fpdf.php');

class PDF extends FPDF
{
//Page header
function Header()
{

	global $name;
	global $total;

	 // get the variable $name1 into the scope of this function
    //Logo
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(70);
    //Title
    $this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C);
    //Line break
    $this->Ln(20);
$this->Cell(0,0,'',1,0);
$this->Ln(20);
$this->cell(50,10, 'Registrant:', 1,0);
$this->cell(50,10, 'Events:', 1,0);
$this->cell(50,10, 'Price:', 1,0);
$this->Ln(10);
$this->cell(50,10,$name, 1,0);
$this->cell(50,10, $events, 1,0);
$this->cell(50,10, $total, 1,0);
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',;
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->Output('ticket.pdf', 'I');
?>

 

but it keeps on displaying zero when it should display 64 because 8 events are registered and are $8 each.  I want to use userid and eventid from previous page to gather the info.  I am confused on this...........sorry

Link to comment
Share on other sites

Is the query definitely fetching the data? Where dose $eventid in the query get set?

 

Try dumping the $row variable with var_dump like this:

 

<?php
$sql = mysql_query("SELECT * FROM Events WHERE userid='$userid' && eventid='$eventid'");
$row = mysql_fetch_array($sql); // don't need to loop since there should only be one result?

var_dump($row); // dump all the rows data
die(); //stop execution
?>

 

Dose it show all the data?

Link to comment
Share on other sites

i believe if I can get this page to link to /ticket.php?eventid=_______ it will work.........I cant seem to make it get the eventid though:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['id'])) { 
   echo 'Please <a href="login.php">log in</a> to access your account';
   exit(); 
}
//Connect to the database through our include 
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$name = $row["name"];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}


// Query member data from the database and ready it 
// Process the form if it is submitted

// Set error message as blank upon arrival to page
$errorMsg = "";
// First we check to see if the form has been submitted 
if (isset($_POST['eventid'])){
$name = ereg_replace("[^A-Z a-z0-9]", "", $_POST['name']); // filter everything but numbers and letters
$event = ereg_replace("[^A-Z a-z0-9]", "", $_POST['event']); // filter everything but spaces, numbers, and letters
$eventid = ereg_replace("[^A-Z a-z0-9]", "", $_POST['eventid']); // filter everything but spaces, numbers, and letters
$userid = ereg_replace("[^A-Z a-z0-9]", "", $_POST['userid']);  
$title1 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title1']); // filter everything but spaces, numbers, and letters
$title2 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title2']); // filter everything but lowercase letters
$title3 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title3']); // filter everything but lowercase letters
$title4 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title4']); // filter everything but lowercase letters
$title5 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title5']); // filter everything but lowercase letters
$title6 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title6']); // filter everything but 
$title7 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title7']); // filter everything but 
$title8 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title8']); // filter everything but 

$email = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['email']); // filter everything but 


$id = ereg_replace("[^A-Z a-z0-9.@,]", "", $_POST['id']);
if (isset($_POST['title8'])) {
  $price8 = $_POST['price8'];
} else {
  $price8 = "";
}
if (isset($_POST['title7'])) {
  $price7 = $_POST['price7'];
} else {
  $price7 = "";
}
if (isset($_POST['title6'])) {
  $price6 = $_POST['price6'];
} else {
  $price6 = "";
}
if (isset($_POST['title5'])) {
  $price5 = $_POST['price5'];
} else {
  $price5 = "";
}
if (isset($_POST['title4'])) {
  $price4 = $_POST['price4'];
} else {
  $price4 = "";
}
if (isset($_POST['title3'])) {
  $price3 = $_POST['price3'];
} else {
  $price3 = "";
}
if (isset($_POST['title2'])) {
  $price2 = $_POST['price2'];
} else {
  $price2 = "";
}
if (isset($_POST['title1'])) {
  $price1 = $_POST['price1'];
} else {
  $price1 = "";
}
// filter everything but 

$sql = "REPLACE INTO Events (name, event, eventid, userid, title1, title2, title3, title4, title5, title6, title7, title8, email, id, price1, price2, price3, price4, price5, price6, price7, price8) 
	VALUES('$name','$event','$eventid','$userid','$title1','$title2','$title3','$title4','$title5','$title6','$title7','$title8','$email','$id','$price1', '$price2', '$price3','$price4','$price5','$price6','$price7','$price8')";
$rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error());

$total = $price1 + $price2 + $price3 + $price4 +$price5 + $price6 + $price7 + $price8;


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Thank you for Registering</title>
<style type="text/css">

#editregion {
position:absolute;
left:-8px;
top:272px;
width:1293px;
height:354px;
z-index:1;
text-align: center;
clear: none;
float: none;
}

body {
background-image: url(button/boyscout1.png);
background-repeat: no-repeat;
position: relative;
}
#menu {
position:relative;
left:160px;
top:0px;
width:931px;
height:59px;
z-index:19;

}
#menu #MenuBar1 li a {
color: #000;
border-top-style: outset;
border-right-style: outset;
border-bottom-style: outset;
border-left-style: outset;
width: 100px;
}

#status {
position:relative;
left:16px;
top:180px;
width:124px;
height:44px;
z-index:14;
}


</style>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
</script>
<style type="text/css">
#apDiv1 {
position:absolute;
left:260px;
top:89px;
width:229px;
height:75px;
z-index:21;
}
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#logout {
position:relative;
left:0px;
top:0pxpx;
width:134px;
height:38px;
z-index:20;
font-weight: bold;
font-size: 24px;
}
#logout a {
color: #000;
}


#status {
text-align: center;
}
#logout1 {
position:absolute;
left:1071px;
top:191px;
width:224px;
height:61px;
z-index:2;
}
#menu2 {
position:absolute;
left:-1px;
top:172px;
width:497px;
height:92px;
z-index:20;
}
#footer {
position:fixed;
left:-10px;
top:0px2
width:1290px;
height:63px;
z-index:300;
color: #000;
background-color: #000;
right: 0px;
bottom: 0px;
}
#editregion p {
text-align: left;
}
</style>
</head>
<body>

<div id="menu2"><div id="menu">
  <ul id="MenuBar1" class="MenuBarHorizontal">
    <li><a href="myprofile.php">My Profile</a>    </li>
    <li><a href="register.php">Register</a></li>
    <li><a href="projects.php">Projects</a>    </li>
    <li><a href="news.php">News</a></li>
    <?php if ($accounttype == "Admin") {
?>
    <li><a href="membermanager.php">Scout Manager</a></li>
    <li><a href="eventmanager.php">Event Manager</a></li>
    <li><a href="newsmanager.php">News Manager</a></li>
  </ul><?php
}
?>
</div></div>

<div id="logout1"><div id="logout"><a href="logout.php">Logout</a></div></div>
<div id="status"><?php echo "$accounttype"; ?>
  <br /><?php echo "$name"; ?>
  <p> </p>
</div>
<div id="editregion">
<p> Thank you for registering for <?php echo $event; ?>.  We have sent an email to your inbox at <?php echo $email; ?>.  If you do not recieve this email, please check your spam folder and add "events@final.net46.net" to your address book to ensure you will   recieve all confirmations in the future.  Please click the file below to print your ticket and please bring it to the next scout meeting.  If you cannot print, please email "<a href="mailto:searls03@gmail.com">searls03@troop078.net46.net</a>" to let him know you have registered. Thanks. <a href="ticket.php">Ticket</a>
<p>
<p>
<div id="apDiv1"> <table width="453" border="1" cellspacing="2" cellpadding="2">
  <tr>
    <th width="167" scope="col">Events:</th>
    <td width="266" scope="col">   <?php
      $sql = ("SELECT * FROM Events WHERE eventid='$eventid' && userid='$userid'");
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$event = $row['event'];
$startdate = $row['startdate'];
$enddate = $row['enddate'];
$description = $row['description'];
$location = $row['location'];
$subevent1 = $row['subevent1'];
$subevent1 = $row['subevent2'];
$subevent3 = $row['subevent3'];
$subevent4 = $row['subevent4'];
$subevent5 = $row['subevent5'];
$subevent6 = $row['subevent6'];
$subevent7 = $row['subevent7'];
$subevent8 = $row['subevent8'];
}

if (!empty($title1)) { echo  "<br/>$title1"; }
if (!empty($title2)) { echo  "<hr><br/>$title2" ; }
if (!empty($title3)) { echo  "<hr><br/>$title3"; }
if (!empty($title4)) { echo  "<hr><br/>$title4"; }
if (!empty($title5)) { echo  "<hr><br/>$title5"; }
if (!empty($title6)) { echo  "<hr> <br/>$title6"; }
if (!empty($title7)) { echo  "<hr><br/>$title7"; }
if (!empty($title8)) { echo  "<hr><br/>$title8"; }
?> </td>
    </tr>
  <tr>
    <th>Price:</th>
    <td><?php echo $total; ?></td>
    </tr>
  <tr>
    <th>Registrant:</th>
    <td><?php echo $name; ?></td>
    </tr>
  </table>
</div>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p>
  <?php if ($accounttype == "Admin") {echo '<div id="footer"><img src="footer_admin.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="10,5,112,32" href="myprofile.php" />
    <area shape="rect" coords="153,5,235,31" href="register.php" />
    <area shape="rect" coords="277,7,333,32" href="news.php" />
    <area shape="rect" coords="471,7,682,33" href="scoutmanager.php" />
    <area shape="rect" coords="726,5,874,34" href="membermanager.php" />
    <area shape="rect" coords="906,3,1058,34" href="eventmanager.php" />
    <area shape="rect" coords="1092,6,1226,32" href="newsmanager.php" />
  </map>
</div>'; } else if ($accounttyp="scout"){echo '<div id="footer"><img src="footer_scout.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="526,6,632,34" href="myprofile.php" />
    <area shape="rect" coords="668,5,752,32" href="register.php" />
    <area shape="rect" coords="789,5,850,34" href="news.php" />
  </map>
</div>';} else {echo '<div id="footer"><img src="footer_admin.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="10,5,112,32" href="myprofile.php" />
    <area shape="rect" coords="153,5,235,31" href="register.php" />
    <area shape="rect" coords="277,7,333,32" href="news.php" />
    <area shape="rect" coords="471,7,682,33" href="scoutmanager.php" />
    <area shape="rect" coords="726,5,874,34" href="membermanager.php" />
    <area shape="rect" coords="906,3,1058,34" href="eventmanager.php" />
    <area shape="rect" coords="1092,6,1226,32" href="newsmanager.php" />
  </map>
</div>'; }
?>
    <?php
  		$to = "$email";
	// Change this to your site admin email
	$from = "events@final.net46.net";
	$subject = "Thank You for Registering for $event. ";





</body>
</html>

 

PS. if I put in a textfield and value is set as $eventid.........it displays correct id..........cant seem to make it link to it though...............right after body begins.

Link to comment
Share on other sites

For event something like:

<?php

$result = mysql_query("SELECT * FROM Events WHERE eventid = '" . mysql_real_escape_string($_GET['eventid']) . "' AND userid = '" . mysql_real_escape_string($userid) . "' LIMIT 1");

$event_data = mysql_fetch_assoc($result);

$event = $event_data['event'];

?>

 

 

To add a dollar to the front do:

$this->cell(50,10, '$' . $total, 1,0);

Link to comment
Share on other sites

no didnt work........this is what i want basically:

<?php
      $sql = ("SELECT * FROM Events WHERE eventid='$eventid' && userid='$userid'");
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$event = $row['event'];
$startdate = $row['startdate'];
$enddate = $row['enddate'];
$description = $row['description'];
$location = $row['location'];
$subevent1 = $row['subevent1'];
$subevent1 = $row['subevent2'];
$subevent3 = $row['subevent3'];
$subevent4 = $row['subevent4'];
$subevent5 = $row['subevent5'];
$subevent6 = $row['subevent6'];
$subevent7 = $row['subevent7'];
$subevent8 = $row['subevent8'];
}

if (!empty($title1)) { echo  "<br/>$title1"; }
if (!empty($title2)) { echo  "<hr><br/>$title2" ; }
if (!empty($title3)) { echo  "<hr><br/>$title3"; }
if (!empty($title4)) { echo  "<hr><br/>$title4"; }
if (!empty($title5)) { echo  "<hr><br/>$title5"; }
if (!empty($title6)) { echo  "<hr> <br/>$title6"; }
if (!empty($title7)) { echo  "<hr><br/>$title7"; }
if (!empty($title8)) { echo  "<hr><br/>$title8"; }
?>

Link to comment
Share on other sites

one last thing............after the $events of course................how can I make it so that a random verification code is put into here:

    $this->Cell(0,10,' ',0,0,'C');

 

doesn't need to be in database.............just some random letters and numbers............

Link to comment
Share on other sites

If you set $ventid and $userid in the code you posted what is the error?

 

To generate a random string:

 

<?php

<?php
// from http://www.lost-in-code.com/programming/php-code/php-random-string-with-numbers-and-letters/
function genRandomString($length = 10) {
     $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
     $string ='';    


    for ($p = 0; $p < $length; $p++) {
         $string .= $characters[mt_rand(0, strlen($characters))];
     }

    return $string;
}

$this->Cell(0,10,genRandomString(),0,0,'C');
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.