Hello all, so I am making a web application (secret for now
) and I need some help on this one part.
You see, the main idea you need to know is, you type something out in a list, then press a button, and it creates a pdf file for you with the content you typed. But for some reason, either the POST or GET is not cooperating correctly.
Help?
Heres the code that you need:
(not all of it)
First Page:
$title = "Edit List Title";
$date="Edit List date";
$list = array("","","","");
$title1 =$_POST['title'];
$date1=$_POST['date'];
for($j = 1; $j < 5; $j++){
$list1 =array($_POST['list'. $j]);
}
echo"<span id='cmd'><a onclick='clear()'>New</a><a href='pdf.php?title=$title1&list1=$list1[0]&list2=$list1[1]&list3=$list1[2]&list4=$list1[3]&date=$date1'>Save</a><a onclick='alert(this)'>Exit</a></span>
<form method='post'><div id='doc'><div id='title'><input type='text' class='big' name='title' value='$title'/><br/>
Date: <input type='text' class='norm' name='date' onKeyPress='return numbersonly(this, event)' value='$date'/>";
for($i = 1; $i < 5; $i++){
echo "<div class='item'><div class='entry'><span>$i.</span><input type='text' class='norm' name='list" . $i . "' value='$list[$i]'/><img src='check.png'/></div>";
}
echo"</form></div>";Second Page (pdf.php)
<?php
$title = $_GET['title'];
$date = $_GET['date'];
for($j = 1; $j < 5; $j++){
$list = $_GET['list' .$j];
}
/*////////////////////////////////////////////*/
/* Create PDF File */
/*////////////////////////////////////////////*/
try {
$p = new PDFlib();
/* open new PDF file; insert a file name to create the PDF on disk */
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->set_info("Creator", "hello.php");
$p->set_info("Author", "NTJ, ListDu");
$p->set_info("Title", "$title");
$p->begin_page_ext(595, 842, "");
$font = $p->load_font("Helvetica-Bold", "winansi", "");
$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show("$date");
$p->continue_text("$list");
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=$title-LISTDU.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;
?>Offline
Try changing the pdf.php file to use $_POST and using these small changes:
Form tag: <form action="pdf.php" id="frm" method="post">
Save link: <a href='javascript:document.getElementById(\"frm\").submit();void(0);'>Save</a>
May not work, but worth a go!
Offline
TheSuccessor wrote:
Try changing the pdf.php file to use $_POST and using these small changes:
Form tag: <form action="pdf.php" id="frm" method="post">
Save link: <a href='javascript:document.getElementById(\"frm\").submit();void(0);'>Save</a>
May not work, but worth a go!![]()
Thanks! I had to do a few more things, but in the end, it worked!
I'll be announcing the name and purpose soon!
Offline
WindowsExplorer wrote:
Let me guess, PDF maker!
Duh. But its different than just that.
Offline
ProgrammingFreak wrote:
WindowsExplorer wrote:
Let me guess, PDF maker!
Duh. But its different than just that.
![]()
I want to know what else it does!
Well then, hurry up mate! Then will you do some PHP for rocket? hehehe.
Offline
wulfmaster wrote:
ProgrammingFreak wrote:
WindowsExplorer wrote:
Let me guess, PDF maker!
Duh. But its different than just that.
![]()
I want to know what else it does!
![]()
Well then, hurry up mate! Then will you do some PHP for rocket? hehehe.
Um, sure!
Offline
ProgrammingFreak wrote:
wulfmaster wrote:
ProgrammingFreak wrote:
Duh. But its different than just that.![]()
I want to know what else it does!
![]()
Well then, hurry up mate! Then will you do some PHP for rocket? hehehe.Um, sure!
![]()
lol thanks.
I'm trying to get rocket started up again!
(You do realise who I am, right?)
Offline
wulfmaster wrote:
ProgrammingFreak wrote:
wulfmaster wrote:
I want to know what else it does!
![]()
Well then, hurry up mate! Then will you do some PHP for rocket? hehehe.Um, sure!
![]()
lol thanks.
![]()
I'm trying to get rocket started up again!![]()
(You do realise who I am, right?)
Yay! And yeah. Youre ssss.
Offline
ProgrammingFreak wrote:
wulfmaster wrote:
ProgrammingFreak wrote:
Um, sure!![]()
lol thanks.
![]()
I'm trying to get rocket started up again!![]()
(You do realise who I am, right?)Yay! And yeah. Youre ssss.
![]()
Lol.
As soon as I help someone with there project, I'll get right on rocket!
Offline