-
Posts
261 -
Joined
-
Last visited
Everything posted by rocky48
-
Hi Button in the correct place now, but the POST is not being passed to the final script (Prnpdf.php). Does the Submit in the next script (VInput.html) clear any POST's previously sumitted. I am nearly there now!
-
Can I add, also the Submit button appears on each row. I would prefer that it appears after the table!
-
Hi to you both! Found why it was erroring- ".method=." should have been ".method."= However script runs OK but the ID posted does not seem to be remembered in the final script. After this script called showtype.php an HTML script runs(VInput.html) to get the rest of the variables required for the final script (Prnpdf.php) which outputs a PDF file. Here are the 2 scripts: VInput.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Generated by Avanquest Technology v:8.0. For information please visit: http://www.avanquestusa.com/ --> <html lang="en"> <head> <title> Verses - A5 Portrait </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css;"> <link rel="stylesheet" href="1066mk2_g.css" type="text/css" media="screen,projection,print"> <!--// Document Style //--> <link rel="stylesheet" href="Vinput_p.css" type="text/css" media="screen,projection,print"> <!--// Page Style //--> <script src="cverses_g.js" type="text/javascript"></script> <!--// Document Script //--> </head> <body BGCOLOR="#00ff66"> <span id="e11"></span> <span id="e12"></span> <span id="e13"></span> <span id="e14"></span> <span id="e15"></span> <span id="e16"></span> <div id="e3" class="navigation"> <a id="a3" class="navigation" href="index.html" target="Vframe5>index"> Home</a> </div> <div id="e4" class="navigation"> <a id="a4" class="navigation" href="1066mk2_002.htm" target="Vframe5>1066mk2_002"> Links</a> </div> <div id="e5" class="navigation"> <a id="a5" class="navigation" href="1066mk2_003.htm" target="Vframe5>1066mk2_003"> Techniques</a> </div> <div id="e6" class="navigation"> <a id="a16" class="navigation" href="topiclist_frame.html" target="Vframe5>topiclist_frame"> Forum</a> </div> <div id="e7" class="navigation"> <a id="a7" class="navigation" href="1066mk2_004.htm" target="Vframe5>1066mk2_004"> Contact Us</a> </div> <div id="e8" class="navigation"> <a id="a8" class="navigation" href="1066mk2_006.htm" target="Vframe5>1066mk2_006"> Gallery</a> </div> <div id="e31" class="cc03"> <form NAME=Lists action="Prnpdf.php" method="post"> <Table> <tr> <th>Card Size</th> </tr> <td> <select name="CSize"> <option value="A5P"> A5 Portrait</option> <option value="A5L"> A5 Landscape</option> <option value="A5PS"> A5 Portrait (single)</option> <option value="A6P"> A6 Portrait</option> <option value="A6L"> A6 Landscape</option> <option value="A6PS"> A6 Portrait (Single)</option> <option value="7x5P"> 7" x 5" Portrait</option> <option value="7x5L"> 7" x 5" Landscape</option> <option value="6x4P"> 6" x 4" Portrait</option> <option value="6x4L"> 6" x 4" Landscape</option> <option value="DLP"> DL Portrait</option> <option value="DLL"> DL Landscape</option> <option value="120SQP"> 120mm Square Portrait</option> <option value="120SQL"> 120mm Square Landscape</option> <option value="125SQP"> 125mm Square Portrait</option> <option value="125SQL"> 125mm Square Landscape</option> <option value="130SQP"> 130mm Square Portrait</option> <option value="130SQL"> 130mm Square Landscape</option> <option value="135SQP"> 135mm Square Portrait</option> <option value="135SQL"> 135mm Square Landscape</option> <option value="145SQP"> 145mm Square Portrait</option> <option value="145SQL"> 145mm Square Landscape</option> <option value="150SQP"> 150mm Square Portrait</option> <option value="150SQL"> 150mm Square Landscape</option> <option value="160SQS"> 160mm Square (Single)</option> <option value="190SQS"> 190mm Square (Single)</option> <option value="200SQS"> 200mm Square (Single)</option> <option value="210SQS"> 210mm Square (Single)</option> </select> <!-- <p><strong>Input Verse ID:</strong><br/> <input type="text" size="10" name="ID"/></p> --> <p><strong>Input Distance from top in mm:</strong><br/> <input type="text" size="10" name="Top"/></p> <p><strong>Input Font size in points:</strong><br/> <input type="text" size="10" name="font"/></p> <p><strong>Check only ONE Tick Box in each section!</strong></p> <p><strong>Text Colour</strong></p> <input type="checkbox" name="color" value="000000000" /> Black<br /> <input type="checkbox" name="color" value="255215000" /> Gold<br /> <input type="checkbox" name="color" value="192192192" /> Silver<br /> <input type="checkbox" name="color" value="255000000" /> Red<br /> <input type="checkbox" name="color" value="000255000" /> Green<br /> <input type="checkbox" name="color" value="000000255" /> Blue<br /><br /> <p><strong>Text Font</strong></p> <input type="checkbox" name="fontface" value="French Script MT" /> French Script MT<br /> <input type="checkbox" name="fontface" value="Batavia" /> Batavia <br /> <input type="checkbox" name="fontface" value="Algerian" /> Algerian <br /> <input type="checkbox" name="fontface" value="Bladerunner" /> Bladerunner <br /> <input type="checkbox" name="fontface" value="Brush Script" /> Brush Script<br /> <input type="checkbox" name="fontface" value="Helterskelter" /> Helterskelter<br /> <input type="checkbox" name="fontface" value="Justice" /> Justice<br /> <input type="checkbox" name="fontface" value="Magneto" /> Magneto<br /> <input type="checkbox" name="fontface" value="Old English" /> Old English<br /> <input type="checkbox" name="fontface" value="Sneakerhead Outline" /> Sneakerhead Outline<br /> <input type="checkbox" name="fontface" value="Trendy" /> Trendy<br /> <input type="checkbox" name="fontface" value="Vladimir Script" /> Vladimir Script<br /> </div> <div id="e32" class="cc03"> <p><strong>Border Images (PORTRAIT)</strong></p> <input type="checkbox" name="image" value="empty.jpg" /> No Border<br /> <input type="checkbox" name="image" value="Border10p.jpg" /> Rose Border<br /> <input type="checkbox" name="image" value="Border2p.jpg" /> Chequered Border<br /> <input type="checkbox" name="image" value="Border11p.jpg" /> Ribbon Border<br /> <input type="checkbox" name="image" value="Border5p.jpg" /> Yellow Border<br /> <input type="checkbox" name="image" value="Corner2p.jpg" /> Leaf Corners<br /> <input type="checkbox" name="image" value="corner1p.jpg" /> Laurel Corners<br /><br /> <p><strong>Border Images (LANDSCAPE)</strong></p> <input type="checkbox" name="image" value="empty.jpg" /> No Border<br /> <input type="checkbox" name="image" value="Border10l.jpg" /> Rose Border<br /> <input type="checkbox" name="image" value="Border2l.jpg" /> Chequered Border<br /> <input type="checkbox" name="image" value="Border11l.jpg" /> Ribbon Border<br /> <input type="checkbox" name="image" value="Border5l.jpg" /> Yellow Border<br /> <input type="checkbox" name="image" value="Corner2l.jpg" /> Leaf Corners<br /> <input type="checkbox" name="image" value="corner1l.jpg" /> Laurel Corners<br /><br /> <input type="submit" value="Submit"/> </form> </div> </body> </html> Prnpdf.php <?php include("loc_cverse_connect.php"); doDB(); //Get the Card Variables $Get_Size_sql = "SELECT * FROM `csize` WHERE `Size` ='".$_POST["CSize"]."'"; $Get_Size_res = mysqli_query($mysqli, $Get_Size_sql) or die(mysqli_error($mysqli)); //$sql = "SELECT * FROM `csize` WHERE Size=\"A5P\""; if (mysqli_num_rows($Get_Size_res) < 1) { //this Card does not exist $display_block = "You have selected an invalid Card size. Please try again."; } else { //get the Event ID while ($Size_info = mysqli_fetch_array($Get_Size_res)) { $BoxX = stripslashes($Size_info['BoxX']); $Cellw = stripslashes($Size_info['Cellw']); $Cellh = stripslashes($Size_info['Cellh']); $SizeI = stripslashes($Size_info['Size']); $SID = stripslashes($Size_info['SID']); $floatx = stripslashes($Size_info['floatx']); $floaty = stripslashes($Size_info['floaty']); $floatw = stripslashes($Size_info['floatw']); $floath = stripslashes($Size_info['floath']); $ort = stripslashes($Size_info['ort']); } //create the display string $display_block = "$ort"; } //verify the Event exists $Get_Verse_sql = "SELECT ID, Event, Sub_Type, Verse FROM Verses WHERE ID = '".$_POST["ID"]."'"; $Get_Verse_res = mysqli_query($mysqli, $Get_Verse_sql) or die(mysqli_error($mysqli)); //check the variable is being passed through if (isset($_POST['ID'])){ echo 'ID is '.$_POST['ID']; } if (mysqli_num_rows($Get_Verse_res) < 1) { //this Event does not exist $display_block = "You have selected an invalid Event. Please try again."; } else { //get the Event ID while ($Verse_info = mysqli_fetch_array($Get_Verse_res)) { $Verse = stripslashes($Verse_info['Verse']); } //create the display string $display_block = "$Verse"; //free results mysqli_free_result($Get_Verse_res); mysqli_free_result($Get_Size_res); //close connection to MySQL mysqli_close($mysqli); } require('fpdf.php'); class PDF extends FPDF { var $B; var $I; var $U; var $HREF; function PDF($orientation='P', $unit='mm', $size='A4') { // Call parent constructor $this->FPDF($orientation,$unit,$size); // Initialization $this->B = 0; $this->I = 0; $this->U = 0; $this->HREF = ''; } function SetStyle($tag, $enable) { // Modify style and select corresponding font $this->$tag += ($enable ? 1 : -1); $style = ''; foreach(array('B', 'I', 'U') as $s) { if($this->$s>0) $style .= $s; } $this->SetFont('',$style); } } $color = $_POST[color]; $r = substr($color,0,3); $g = substr($color,3,3); $b = substr($color,6,3); $image=$_POST[image]; $pdf = new PDF($ort,'mm','A4'); $pdf->AddPage(); $pdf->AddFont('French Script MT','','frscript.php'); $pdf->AddFont('Batavia','','Batavia_.php'); $pdf->AddFont('Algerian','','Alger.php'); $pdf->AddFont('Bladerunner','','BLADRMF_.php'); $pdf->AddFont('Brush Script','','BRUSHSCI.php'); $pdf->AddFont('Helterskelter','','Helte___.php'); $pdf->AddFont('Justice','','Justice_.php'); $pdf->AddFont('Magneto','','MAGNETOB.php'); $pdf->AddFont('Old English','','OldEngl.php'); $pdf->AddFont('Sneakerhead Outline','','Sneabo__.php'); $pdf->AddFont('Trendy','','Trendy__.php'); $pdf->AddFont('Vladimir Script','','VLADIMIR.php'); $pdf->SetTextColor($r,$g,$b); $pdf->SetFont($_POST[fontface],'',$_POST[font]); $pdf->SetXY($BoxX, $_POST[Top]); $pdf->Image($image,$floatx,$floaty,$floatw,$floath,jpg,''); $pdf->MultiCell($Cellw,$Cellh,$display_block,'' ,'C'); $pdf->SetFont(''); $pdf->Output('verse.pdf','D'); ?> Why does it not remember the post?
-
Thanks for your input! I am getting a syntax error unexpected '=' on line 64. Why has the method got a dot before it? Without the dot it gives unexpected T_STRING on line 64. Also surely the form tag should be closed some where!
-
Discovered some errors with quotes so line should be: <td width=\"9%\" valign=\"top\"> <INPUT TYPE='Radio' NAME='ID' VALUE='".$Verse_id."'/></td> Now I get Radio button, but how do I Submit this POST. Tried to enclose table within a FORM but get a T_STRING Error. Not shure where the form tags need to go?
-
I am using MYSQL to filter the database and the output that is generated is output as a table. I want the user to choose one of the rows on the table and the result be posted for use in a later program. I have tried the following but all it produces is the text in the box: //create the display string $display_block = " <p> The Event Type is <b> '".$Event_Name."'</b> </p> <table width=\"70%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" > <tr> <th>ID</th> <th>VERSE</th> <th>MOOD/SUB TYPE</th> <th>Link</th> </tr>"; while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Verse_id = $Verse_info['versesID']; $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; //add to display $display_block .= " <tr> <td width=\"1%\" valign=\"top\">".$Verse_id."<br/></td> <td width=\"55%\" valign=\"top\">".$Verse_text."<br/></td> <td width=\"35%\" valign=\"top\">".$Mood_info."<br/></td> <td width=\"9%\" valign=\"top\"> <INPUT TYPE="Radio" NAME="ID" VALUE=".$Verse_id." /></td> </tr>"; } //free results mysqli_free_result($get_Event_res); mysqli_free_result($verify_Event_res); //close connection to MySQL mysqli_close($mysqli); //close up the table $display_block .= "</table>"; } Can anyone suggest the correct way to allow the script to work as I wish?
-
Thanks it turned out to be a problem with the routine for working out the RGB values.
-
I have scripted an input form which outputs using POST method and all of the posts work bar one! I am using FPDF and want to change the font colour, so I have devised a method where I have created a string for the RGB values, like so: 255000000 = Red and so on. This method worked previously, but I am trying to streamline the scripts to make it easier to maintain. In the latest version of the script it does not work since I added the Select input method. I added a SELECT list in front of the previous script to enable the user to select a card size. I am puzzled why only this part does not work and the rest does? Here is the script for the form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Generated by Avanquest Technology v:8.0. For information please visit: http://www.avanquestusa.com/ --> <html lang="en"> <head> <title> Verses - A5 Portrait </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css;"> <link rel="stylesheet" href="1066mk2_g.css" type="text/css" media="screen,projection,print"> <!--// Document Style //--> <link rel="stylesheet" href="Vinput_p.css" type="text/css" media="screen,projection,print"> <!--// Page Style //--> <script src="cverses_g.js" type="text/javascript"></script> <!--// Document Script //--> </head> <body BGCOLOR="#00ff66"> <span id="e11"></span> <span id="e12"></span> <span id="e13"></span> <span id="e14"></span> <span id="e15"></span> <span id="e16"></span> <div id="e3" class="navigation"> <a id="a3" class="navigation" href="index.html" target="Vframe5>index"> Home</a> </div> <div id="e4" class="navigation"> <a id="a4" class="navigation" href="1066mk2_002.htm" target="Vframe5>1066mk2_002"> Links</a> </div> <div id="e5" class="navigation"> <a id="a5" class="navigation" href="1066mk2_003.htm" target="Vframe5>1066mk2_003"> Techniques</a> </div> <div id="e6" class="navigation"> <a id="a16" class="navigation" href="topiclist_frame.html" target="Vframe5>topiclist_frame"> Forum</a> </div> <div id="e7" class="navigation"> <a id="a7" class="navigation" href="1066mk2_004.htm" target="Vframe5>1066mk2_004"> Contact Us</a> </div> <div id="e8" class="navigation"> <a id="a8" class="navigation" href="1066mk2_006.htm" target="Vframe5>1066mk2_006"> Gallery</a> </div> <div id="e31" class="cc03"> <form NAME=Lists action="Prnpdf.php" method="post"> <Table> <tr> <th>Card Size</th> </tr> <td> <select name="CSize"> <option value="A5P"> A5 Portrait</option> <option value="A5L"> A5 Landscape</option> <option value="A5PS"> A5 Portrait (single)</option> <option value="A6P"> A6 Portrait</option> <option value="A6L"> A6 Landscape</option> <option value="A6PS"> A6 Portrait (Single)</option> <option value="7x5P"> 7" x 5" Portrait</option> <option value="7x5L"> 7" x 5" Landscape</option> <option value="6x4P"> 6" x 4" Portrait</option> <option value="6x4L"> 6" x 4" Landscape</option> <option value="DLP"> DL Portrait</option> <option value="DLL"> DL Landscape</option> <option value="120SQP"> 120mm Square Portrait</option> <option value="120SQL"> 120mm Square Landscape</option> <option value="125SQP"> 125mm Square Portrait</option> <option value="125SQL"> 125mm Square Landscape</option> <option value="130SQP"> 130mm Square Portrait</option> <option value="130SQL"> 130mm Square Landscape</option> <option value="135SQP"> 135mm Square Portrait</option> <option value="135SQL"> 135mm Square Landscape</option> <option value="145SQP"> 145mm Square Portrait</option> <option value="145SQL"> 145mm Square Landscape</option> <option value="150SQP"> 150mm Square Portrait</option> <option value="150SQL"> 150mm Square Landscape</option> <option value="160SQS"> 160mm Square (Single)</option> <option value="190SQS"> 190mm Square (Single)</option> <option value="200SQS"> 200mm Square (Single)</option> <option value="210SQS"> 210mm Square (Single)</option> </select> <p><strong>Input Verse ID:</strong><br/> <input type="text" size="10" name="ID"/></p> <p><strong>Input Distance from top in mm:</strong><br/> <input type="text" size="10" name="Top"/></p> <p><strong>Input Font size in points:</strong><br/> <input type="text" size="10" name="font"/></p> <p><strong>Check only ONE Tick Box in each section!</strong></p> <p><strong>Text Colour</strong></p> <input type="checkbox" name="txtcolor" value="000000000" /> Black<br /> <input type="checkbox" name="txtcolor" value="255215000" /> Gold<br /> <input type="checkbox" name="txtcolor" value="192192192" /> Silver<br /> <input type="checkbox" name="txtcolor" value="255000000" /> Red<br /> <input type="checkbox" name="txtcolor" value="000255000" /> Green<br /> <input type="checkbox" name="txtcolor" value="000000255" /> Blue<br /><br /> <p><strong>Text Font</strong></p> <input type="checkbox" name="fontface" value="French Script MT" /> French Script MT<br /> <input type="checkbox" name="fontface" value="Batavia" /> Batavia <br /> <input type="checkbox" name="fontface" value="Algerian" /> Algerian <br /> <input type="checkbox" name="fontface" value="Bladerunner" /> Bladerunner <br /> <input type="checkbox" name="fontface" value="Brush Script" /> Brush Script<br /> <input type="checkbox" name="fontface" value="Helterskelter" /> Helterskelter<br /> <input type="checkbox" name="fontface" value="Justice" /> Justice<br /> <input type="checkbox" name="fontface" value="Magneto" /> Magneto<br /> <input type="checkbox" name="fontface" value="Old English" /> Old English<br /> <input type="checkbox" name="fontface" value="Sneakerhead Outline" /> Sneakerhead Outline<br /> <input type="checkbox" name="fontface" value="Trendy" /> Trendy<br /> <input type="checkbox" name="fontface" value="Vladimir Script" /> Vladimir Script<br /> </div> <div id="e32" class="cc03"> <p><strong>Border Images (PORTRAIT)</strong></p> <input type="checkbox" name="image" value="empty.jpg" /> No Border<br /> <input type="checkbox" name="image" value="Border10p.jpg" /> Rose Border<br /> <input type="checkbox" name="image" value="Border2p.jpg" /> Chequered Border<br /> <input type="checkbox" name="image" value="Border11p.jpg" /> Ribbon Border<br /> <input type="checkbox" name="image" value="Border5p.jpg" /> Yellow Border<br /> <input type="checkbox" name="image" value="Corner2p.jpg" /> Leaf Corners<br /> <input type="checkbox" name="image" value="corner1p.jpg" /> Laurel Corners<br /><br /> <p><strong>Border Images (LANDSCAPE)</strong></p> <input type="checkbox" name="image" value="empty.jpg" /> No Border<br /> <input type="checkbox" name="image" value="Border10l.jpg" /> Rose Border<br /> <input type="checkbox" name="image" value="Border2l.jpg" /> Chequered Border<br /> <input type="checkbox" name="image" value="Border11l.jpg" /> Ribbon Border<br /> <input type="checkbox" name="image" value="Border5l.jpg" /> Yellow Border<br /> <input type="checkbox" name="image" value="Corner2l.jpg" /> Leaf Corners<br /> <input type="checkbox" name="image" value="corner1l.jpg" /> Laurel Corners<br /><br /> <input type="submit" value="Submit"/> </form> </div> </body> </html> Here is the output script: <?php include("loc_cverse_connect.php"); doDB(); //Get the Card Variables $Get_Size_sql = "SELECT * FROM csize WHERE Size ='".$_POST["CSize"]."'"; $Get_Size_res = mysqli_query($mysqli, $Get_Size_sql) or die(mysqli_error($mysqli)); //$sql = "SELECT * FROM `csize` WHERE Size=\"A5P\""; if (mysqli_num_rows($Get_Size_res) < 1) { //this Card does not exist $display_block = "You have selected an invalid Card size. Please try again."; } else { //get the Event ID while ($Size_info = mysqli_fetch_array($Get_Size_res)) { $BoxX = stripslashes($Size_info['BoxX']); $Cellw = stripslashes($Size_info['Cellw']); $Cellh = stripslashes($Size_info['Cellh']); $SizeI = stripslashes($Size_info['Size']); $SID = stripslashes($Size_info['SID']); $floatx = stripslashes($Size_info['floatx']); $floaty = stripslashes($Size_info['floaty']); $floatw = stripslashes($Size_info['floatw']); $floath = stripslashes($Size_info['floath']); $ort = stripslashes($Size_info['ort']); } //create the display string $display_block = "$ort"; } //verify the Event exists $Get_Verse_sql = "SELECT ID, Event, Sub_Type, Verse FROM Verses WHERE ID = '".$_POST["ID"]."'"; $Get_Verse_res = mysqli_query($mysqli, $Get_Verse_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($Get_Verse_res) < 1) { //this Event does not exist $display_block = "You have selected an invalid Event. Please try again."; } else { //get the Event ID while ($Verse_info = mysqli_fetch_array($Get_Verse_res)) { $Verse = stripslashes($Verse_info['Verse']); } //create the display string $display_block = "$Verse"; //free results mysqli_free_result($Get_Verse_res); mysqli_free_result($Get_Size_res); //close connection to MySQL mysqli_close($mysqli); } require('fpdf.php'); class PDF extends FPDF { var $B; var $I; var $U; var $HREF; function PDF($orientation='P', $unit='mm', $size='A4') { // Call parent constructor $this->FPDF($orientation,$unit,$size); // Initialization $this->B = 0; $this->I = 0; $this->U = 0; $this->HREF = ''; } function SetStyle($tag, $enable) { // Modify style and select corresponding font $this->$tag += ($enable ? 1 : -1); $style = ''; foreach(array('B', 'I', 'U') as $s) { if($this->$s>0) $style .= $s; } $this->SetFont('',$style); } } $txtcolor = $POST[txtcolor]; $r = substr($txtcolor,0,3); $g = substr($txtcolor,4,3); $b = substr($txtcolor,7,3); $image=$_POST[image]; $pdf = new PDF($ort,'mm','A4'); $pdf->AddPage(); $pdf->AddFont('French Script MT','','frscript.php'); $pdf->AddFont('Batavia','','Batavia_.php'); $pdf->AddFont('Algerian','','Alger.php'); $pdf->AddFont('Bladerunner','','BLADRMF_.php'); $pdf->AddFont('Brush Script','','BRUSHSCI.php'); $pdf->AddFont('Helterskelter','','Helte___.php'); $pdf->AddFont('Justice','','Justice_.php'); $pdf->AddFont('Magneto','','MAGNETOB.php'); $pdf->AddFont('Old English','','OldEngl.php'); $pdf->AddFont('Sneakerhead Outline','','Sneabo__.php'); $pdf->AddFont('Trendy','','Trendy__.php'); $pdf->AddFont('Vladimir Script','','VLADIMIR.php'); $pdf->SetTextColor($r,$g,$b); $pdf->SetFont($_POST[fontface],'',$_POST[font]); $pdf->SetXY($BoxX, $_POST[Top]); $pdf->Image($image,$floatx,$floaty,$floatw,$floath,jpg,''); $pdf->MultiCell($Cellw,$Cellh,$display_block,'' ,'C'); $pdf->SetFont(''); $pdf->Output('verse.pdf','D'); ?> Can anyone see where I have gone wrong?
-
Hi The $Verse_id comes from the second batch of code which queries the database to list all verse of a choosen type (e.g. Birthday). I don't understand why you have suggested the addition of the line suggested as Fontface is the font that the user has choosen for the output. What I am unsure of is how long the life of the variable $Verse_id can be stored for use in the last script which outputs the verse via a printer. The other thing that I am unsure of is whether the way I have put a link on each line of the output from the query will store the ID of the line its on. This may be why I am not getting the results I am expecting. Has anyone got any ideas on how I can store this variable for the line in the output table?
-
I am trying to pass a value obtained by a php script that queries my database. The database is to choose a greeting verse from the database using a tick box to choose: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Generated by Avanquest Technology v:8.0. For information please visit: http://www.avanquestusa.com/ --> <html lang="en"> <head> <title> CVerses » Page 1 of 1 </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css;"> <link rel="stylesheet" href="1066mk2_g.css" type="text/css" media="screen,projection,print"> <!--// Document Style //--> <link rel="stylesheet" href="VerseIDinput_p.css" type="text/css" media="screen,projection,print"> <!--// Page Style //--> <script src="cverses_g.js" type="text/javascript"></script> <!--// Document Script //--> </head> <body BGCOLOR="#00ff66"> <span id="e11"></span> <span id="e12"></span> <span id="e13"></span> <span id="e14"></span> <span id="e15"></span> <span id="e16"></span> <div id="e3" class="navigation"> <a id="a3" class="navigation" href="index.html" target="Vframe5>index"> Home</a> </div> <div id="e4" class="navigation"> <a id="a4" class="navigation" href="1066mk2_002.htm" target="Vframe5>1066mk2_002"> Links</a> </div> <div id="e5" class="navigation"> <a id="a5" class="navigation" href="1066mk2_003.htm" target="Vframe5>1066mk2_003"> Techniques</a> </div> <div id="e6" class="navigation"> <a id="a16" class="navigation" href="topiclist_frame.html" target="Vframe5>topiclist_frame"> Forum</a> </div> <div id="e7" class="navigation"> <a id="a7" class="navigation" href="1066mk2_004.htm" target="Vframe5>1066mk2_004"> Contact Us</a> </div> <div id="e8" class="navigation"> <a id="a8" class="navigation" href="1066mk2_006.htm" target="Vframe5>1066mk2_006"> Gallery</a> </div> <div id="e30"> <p> </br> You can filter the database, by checking the check box and clicking the submit button, to list all greetings of the same type of Event.</br> </br> </br> Only check ONE box! </div> <div id="e31"> <form action="showType.php" method="post"> <input type="checkbox" name="Event_Type" value="1" /> Birthday<br /> <input type="checkbox" name="Event_Type" value="2" /> Christmas <br /> <input type="checkbox" name="Event_Type" value="3" /> Friends <br /> <input type="checkbox" name="Event_Type" value="4" /> Wedding <br /> <input type="checkbox" name="Event_Type" value="5" /> Anniversary <br /> <input type="checkbox" name="Event_Type" value="6" /> Retirement <br /> <input type="checkbox" name="Event_Type" value="7" /> New Baby <br /> <input type="checkbox" name="Event_Type" value="8" /> New Job <br /> <input type="checkbox" name="Event_Type" value="9" /> Get Well <br /> <input type="checkbox" name="Event_Type" value="10" /> Valentine <br /> <input type="checkbox" name="Event_Type" value="11" /> New Home <br /> <input type="checkbox" name="Event_Type" value="12" /> Romantic <br /> <input type="checkbox" name="Event_Type" value="13" /> Rhyme <br /> <input type="checkbox" name="Event_Type" value="14" /> Religious <br /> <input type="checkbox" name="Event_Type" value="15" /> Engagement <br /> <input type="checkbox" name="Event_Type" value="16" /> Mothers Day <br /> <input type="checkbox" name="Event_Type" value="17" /> Fathers Day <br /> <input type="checkbox" name="Event_Type" value="18" /> Renewal of Vows <br /> <input type="checkbox" name="Event_Type" value="19" /> Christening <br /> <input type="checkbox" name="Event_Type" value="20" /> Sympathy <br /> <input type="checkbox" name="Event_Type" value="21" /> Leaving <br /> <input type="checkbox" name="Event_Type" value="22" /> Easter <br /> <br /> <input type="submit" value="Submit" /> </form> </div> </body> </html> Then a php script displays the result: <?php include("Loc_cverse_connect.php"); doDB(); //check for required info from the query string //verify the Event exists $verify_Event_sql = "SELECT ID, Event_Type FROM Events WHERE ID = '".$_POST["Event_Type"]."'"; $verify_Event_res = mysqli_query($mysqli, $verify_Event_sql) or die(mysqli_error($mysqli)); //echo $_POST["Event_Type"]; if (mysqli_num_rows($verify_Event_res) < 1) { //this Event does not exist $display_block = "<p><em>You have selected an invalid Event.<br/> Please try again.</em></p>"; } else { //get the Event ID while ($Event_info = mysqli_fetch_array($verify_Event_res)) { $Event_ID = stripslashes($Event_info['ID']); $Event_Name = ($Event_info['Event_Type']); } //gather the Events $get_Event_sql = "SELECT Verses.ID AS versesID, Verses.Verse, Verses.Sub_Type, Verses.Event, Events.ID AS eventsID, Events.Event_Type, Event_Sub.ID AS event_SubID, Event_Sub.Event_Sub_Type FROM Verses LEFT JOIN Events ON Verses.Event = Events.ID LEFT JOIN Event_Sub ON Verses.Sub_Type = Event_Sub.ID WHERE Verses.Event = '".$_POST["Event_Type"]."' ORDER BY Verses.ID ASC"; $get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli)); //create the display string $display_block = " <p> The Event Type is <b> '".$Event_Name."'</b> </p> <table width=\"70%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" > <tr> <th>ID</th> <th>VERSE</th> <th>MOOD/SUB TYPE</th> <th>Link</th> </tr>"; while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Verse_id = $Verse_info['versesID']; $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; //add to display $display_block .= " <tr> <td width=\"1%\" valign=\"top\">".$Verse_id."<br/></td> <td width=\"55%\" valign=\"top\">".$Verse_text."<br/></td> <td width=\"35%\" valign=\"top\">".$Mood_info."<br/></td> <td width=\"9%\" valign=\"top\"><a href=\"Size_Menu.html\">Click here to choose</a> </td> </tr>"; } //free results //mysqli_free_result($get_Event_res); //mysqli_free_result($verify_Event_res); //close connection to MySQL //mysqli_close($mysqli); //close up the table $display_block .= "</table>"; } ?> <html> <head> <title> List of Verses</title> </head> <body BGCOLOR="#87CEEB"> <h1>Verses</h1> <?php echo $display_block; ?> </body> </html> I have put a cell on each line that hopefully chooses that line (Not sure if this will work?) Then select card size: <html> <head> <title>Card Verse Print</title> <link rel="stylesheet" href="1066mk2_g.css" type="text/css" media="screen,projection,print"> <link rel="stylesheet" href="Size_p.css" type="text/css" media="screen,projection,print"> <!--// Page Style //--> </head> <body BGCOLOR="#00ff66"> <span id="e11"></span> <span id="e12"></span> <span id="e13"></span> <span id="e14"></span> <span id="e15"></span> <span id="e16"></span> <div id="e3" class="navigation"> <a id="a3" class="navigation" href="index.html" target="Vframe5>index"> Home</a> </div> <div id="e4" class="navigation"> <a id="a4" class="navigation" href="1066mk2_002.htm" target="Vframe5>1066mk2_002"> Links</a> </div> <div id="e5" class="navigation"> <a id="a5" class="navigation" href="1066mk2_003.htm" target="Vframe5>1066mk2_003"> Techniques</a> </div> <div id="e6" class="navigation"> <a id="a16" class="navigation" href="topiclist_frame.html" target="Vframe5>topiclist_frame"> Forum</a> </div> <div id="e7" class="navigation"> <a id="a7" class="navigation" href="1066mk2_004.htm" target="Vframe5>1066mk2_004"> Contact Us</a> </div> <div id="e8" class="navigation"> <a id="a8" class="navigation" href="1066mk2_006.htm" target="Vframe5>1066mk2_006"> Gallery</a> </div> <div id="e30" class="cc08" <h1>Card Size Menu <table border="1"> <tr> <th>Card Size/Orientation</th> <th>Paper Orientation</th> <th>Cut Size</th> </tr> <tr> <td> <a href="VinputA5P.html">A5 Portrait</a></td> <td> Landscape </td> <td> 297 x 210mm </td> </tr> <tr> <td> <a href="VinputA5L.html">A5 Landscape</a></td> <td> Portrait </td> <td> 210 x 297mm </td> </tr> <tr> <td> <a href="VinputA5PS.html">A5 Portrait (single)</a></td> <td> Portrait </td> <td> 148 x 210mm </td> </tr> <tr> <td> <a href="VinputA6P.html">A6 Portrait</a></td> <td> Portrait </td> <td> 210 x 148mm </td> </tr> <tr> <td> <a href="VinputA6L.html">A6 Landscape</a></td> <td> Landscape </td> <td> 148 x 210mm </td> </tr> <tr> <td> <a href="VinputA6PS.html">A6 Portrait (Single)</a></td> <td> Portrait </td> <td> 105 x 148mm </td> </tr> <tr> <td> <a href="Vinput7x5P.html">7" x 5" Portrait</a></td> <td> Landscape </td> <td> 10" x 7" </td> </tr> <tr> <td> <a href="Vinput7x5L.html">7" x 5" Landscape</a></td> <td> Portrait </td> <td> 7" x 10" </td> </tr> <tr> <td> <a href="Vinput6x4P.html">6" x 4" Portrait</a></td> <td> Landscape </td> <td> 8" x 6" </td> </tr> <tr> <td> <a href="Vinput6x4L.html">6" x 4" Landscape</a></td> <td> Portrait </td> <td> 6" x 8" </td> </tr> <tr> <td> <a href="VinputDLP.html">DL Portrait </a></td> <td> Portrait </td> <td> 198 x 210mm </td> <tr> <td> <a href="VinputDLL.html">DL Landscape</a></td> <td> Portrait </td> <td> 210 x 198mm </td> </tr> <tr> <td> <a href="Vinput120SQP.html">120mm Square Portrait</a></td> <td> Landscape </td> <td> 240 x 120mm </td> </tr> <tr> <td> <a href="Vinput120SQL.html">120mm Square Landscape</a></td> <td> Portrait </td> <td> 120 x 240mm </td> </tr> <tr> <td> <a href="Vinput125SQP.html">125mm Square Portrait</a></td> <td> Landscape </td> <td> 250 x 125mm </td> </tr> <tr> <td> <a href="Vinput125SQL.html">125mm Square Landscape</a></td> <td> Portrait </td> <td> 125 x 250mm </td> </tr> <tr> <td> <a href="Vinput130SQP.html">130mm Square Portrait</a></td> <td> Landscape </td> <td> 260 x 130mm </td> <tr> <td> <a href="Vinput130SQL.html">130mm Square Landscape</a></td> <td> Portrait </td> <td> 130 x 260mm </td> </tr> <tr> <td> <a href="Vinput135SQP.html">135mm Square Portrait</a></td> <td> Landscape </td> <td> 270 x 135mm </td> </tr> <tr> <td> <a href="Vinput135SQL.html">135mm Square Landscape</a></td> <td> Portrait </td> <td> 135 x 270mm </td> </tr> <tr> <td> <a href="Vinput145SQP.html">145mm Square Portrait</a></td> <td> Landscape </td> <td> 290 x 145mm </td> </tr> <tr> <td> <a href="Vinput145SQL.html">145mm Square Landscape</a></td> <td> Portrait </td> <td> 145 x 290mm </td> </tr> <tr> <td> <a href="Vinput150SQP.html">150mm Square Portrait</a></td> <td> Landscape </td> <td> 297 x 150mm </td> </tr> <tr> <td> <a href="Vinput150SQL.html">150mm Square Landscape</a></td> <td> Portrait </td> <td> 150 x 297mm </td> </tr> <tr> <td> <a href="Vinput160SQS.html">160mm Square (Single)</a></td> <td> Landscape </td> <td> 160 x 160mm </td> </tr> <tr> <td> <a href="Vinput190SQS.html">190mm Square (Single)</a></td> <td> Portrait </td> <td> 190 x 190mm </td> </tr> <tr> <td> <a href="Vinput200SQS.html">200mm Square (Single)</a></td> <td> Portrait </td> <td> 200 x 200mm </td> </tr> </table> </div> </body> </html> Choice links to correct html script that user enters some variables: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Generated by Avanquest Technology v:8.0. For information please visit: http://www.avanquestusa.com/ --> <html lang="en"> <head> <title> Verses - A5 Portrait </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css;"> <link rel="stylesheet" href="1066mk2_g.css" type="text/css" media="screen,projection,print"> <!--// Document Style //--> <link rel="stylesheet" href="Vinput_p.css" type="text/css" media="screen,projection,print"> <!--// Page Style //--> <script src="cverses_g.js" type="text/javascript"></script> <!--// Document Script //--> </head> <body BGCOLOR="#00ff66"> <span id="e11"></span> <span id="e12"></span> <span id="e13"></span> <span id="e14"></span> <span id="e15"></span> <span id="e16"></span> <div id="e3" class="navigation"> <a id="a3" class="navigation" href="index.html" target="Vframe5>index"> Home</a> </div> <div id="e4" class="navigation"> <a id="a4" class="navigation" href="1066mk2_002.htm" target="Vframe5>1066mk2_002"> Links</a> </div> <div id="e5" class="navigation"> <a id="a5" class="navigation" href="1066mk2_003.htm" target="Vframe5>1066mk2_003"> Techniques</a> </div> <div id="e6" class="navigation"> <a id="a16" class="navigation" href="topiclist_frame.html" target="Vframe5>topiclist_frame"> Forum</a> </div> <div id="e7" class="navigation"> <a id="a7" class="navigation" href="1066mk2_004.htm" target="Vframe5>1066mk2_004"> Contact Us</a> </div> <div id="e8" class="navigation"> <a id="a8" class="navigation" href="1066mk2_006.htm" target="Vframe5>1066mk2_006"> Gallery</a> </div> <div id="e30" class="cc03"> <form action="PrnpdfA5P.php" method="post"> <p><strong>Input Distance from top in mm:</strong><br/> <input type="text" size="10" name="Top"/></p> <p><strong>Input Font size in points:</strong><br/> <input type="text" size="10" name="font"/></p> <p><strong>Check only ONE Tick Box in each section!</strong></p> <p><strong>Text Colour</strong></p> <input type="checkbox" name="color" value="000000000" /> Black<br /> <input type="checkbox" name="color" value="255215000" /> Gold<br /> <input type="checkbox" name="color" value="192192192" /> Silver<br /> <input type="checkbox" name="color" value="255000000" /> Red<br /> <input type="checkbox" name="color" value="000255000" /> Green<br /> <input type="checkbox" name="color" value="000000255" /> Blue<br /><br /> <p><strong>Text Font</strong></p> <input type="checkbox" name="fontface" value="French Script MT" /> French Script MT<br /> <input type="checkbox" name="fontface" value="Batavia" /> Batavia <br /> <input type="checkbox" name="fontface" value="Algerian" /> Algerian <br /> <input type="checkbox" name="fontface" value="Bladerunner" /> Bladerunner <br /> <input type="checkbox" name="fontface" value="Brush Script" /> Brush Script<br /> <input type="checkbox" name="fontface" value="Helterskelter" /> Helterskelter<br /> <input type="checkbox" name="fontface" value="Justice" /> Justice<br /> <input type="checkbox" name="fontface" value="Magneto" /> Magneto<br /> <input type="checkbox" name="fontface" value="Old English" /> Old English<br /> <input type="checkbox" name="fontface" value="Sneakerhead Outline" /> Sneakerhead Outline<br /> <input type="checkbox" name="fontface" value="Trendy" /> Trendy<br /> <input type="checkbox" name="fontface" value="Vladimir Script" /> Vladimir Script<br /> <input type="submit" value="Submit"/> </form> </div> </body> </html> This then runs php script to produce output. It also runs Mysql query to extract the chosen verse: <?php include("loc_cverse_connect.php"); doDB(); //verify the Event exists $Get_Verse_sql = "SELECT ID, Event, Sub_Type, Verse FROM Verses WHERE ID = '".$Verse_id."'"; $Get_Verse_res = mysqli_query($mysqli, $Get_Verse_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($Get_Verse_res) < 1) { //this Event does not exist $display_block = "You have selected an invalid Event. Please try again."; } else { //get the Event ID while ($Verse_info = mysqli_fetch_array($Get_Verse_res)) { $Verse = stripslashes($Verse_info['Verse']); } //create the display string $display_block = "$Verse"; //free results mysqli_free_result($Get_Verse_res); //close connection to MySQL mysqli_close($mysqli); } require('fpdf.php'); class PDF extends FPDF { var $B; var $I; var $U; var $HREF; function PDF($orientation='L', $unit='mm', $size='A4') { // Call parent constructor $this->FPDF($orientation,$unit,$size); // Initialization $this->B = 0; $this->I = 0; $this->U = 0; $this->HREF = ''; } function SetStyle($tag, $enable) { // Modify style and select corresponding font $this->$tag += ($enable ? 1 : -1); $style = ''; foreach(array('B', 'I', 'U') as $s) { if($this->$s>0) $style .= $s; } $this->SetFont('',$style); } } $color = $POST[color]; $r = substr($color,0,3); $g = substr($color,4,3); $b = substr($color,7,3); $pdf = new PDF(); $pdf->AddPage(); $pdf->AddFont('French Script MT','','frscript.php'); $pdf->AddFont('Batavia','','Batavia_.php'); $pdf->AddFont('Algerian','','Alger.php'); $pdf->AddFont('Bladerunner','','BLADRMF_.php'); $pdf->AddFont('Brush Script','','BRUSHSCI.php'); $pdf->AddFont('Helterskelter','','Helte___.php'); $pdf->AddFont('Justice','','Justice_.php'); $pdf->AddFont('Magneto','','MAGNETOB.php'); $pdf->AddFont('Old English','','OldEngl.php'); $pdf->AddFont('Sneakerhead Outline','','Sneabo__.php'); $pdf->AddFont('Trendy','','Trendy__.php'); $pdf->AddFont('Vladimir Script','','VLADIMIR.php'); $pdf->SetTextColor(255,215,000); $pdf->SetFont($_POST[fontface],'',$_POST[font]); $pdf->SetXY(170, $_POST[Top]); $pdf->MultiCell(108,10,$display_block,'' ,'C'); $pdf->SetFont(''); $pdf->Output('verse.pdf','D'); ?> It appears not to put the verse_ID into the final php script as it runs the error part of the script. Any ideas as to how I get this to work correctly?
-
I put a quote after > (near top), but still get the same error? Am I being really thick!
-
I have rewritten a script to include a link in a table, but it comes up with a parse error: unexpected T_STRING //create the display string $display_block = " <p> The Event Type is <b> '".$Event_Name."'</b> </p> <table width=\"70%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" > <tr> <th>ID</th> <th>VERSE</th> <th>MOOD/SUB TYPE</th> <th>Link</th> </tr>"; while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Verse_id = $Verse_info['versesID']; $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; //add to display $display_block .= " <tr> <td width=\"1%\" valign=\"top\">".$Verse_id."<br/></td> <td width=\"55%\" valign=\"top\">".$Verse_text."<br/></td> <td width=\"35%\" valign=\"top\">" .$Mood_info."<br/></td> <td width=\"9%\" valign=\"top\"> <a href="Size_Menu.html">Click here to choose</a> </td> </tr>"; } Can't see what is wrong! Am I missing something?
-
Hi Yes this does work, but I am trying to make it more user friendly by eliminating some of the user input. It has been suggested elsewhere that I can use href, but I have not figured out how to do this yet. Does any one know how long a POST is stored, as if I get the hef to work it will need to survive until i have run another html script, before the value is used in a php script?
-
I am a programming novice. I aploigise if this is in the wrong forum, but the question embraces several languages. I have written a script in PHP that filters Greetings Verses of a certain type. What I want to do is pick one of the filtered verses, store its ID to be used in the script that prints out the verse. I am not sure that you can add a $Post to a form that has been output from MYSQL. Can anyone help? I would appreciate any ideas or alternative ways of achieving this. Here is the script: <?php include("loc_cverse_connect.php"); doDB(); //check for required info from the query string //verify the Event exists $verify_Event_sql = "SELECT ID, Event_Type FROM Events WHERE ID = '".$_POST["Event_Type"]."'"; $verify_Event_res = mysqli_query($mysqli, $verify_Event_sql) or die(mysqli_error($mysqli)); //echo $_POST["Event_Type"]; if (mysqli_num_rows($verify_Event_res) < 1) { //this Event does not exist $display_block = "<p><em>You have selected an invalid Event.<br/> Please try again.</em></p>"; } else { //get the Event ID while ($Event_info = mysqli_fetch_array($verify_Event_res)) { $Event_ID = stripslashes($Event_info['ID']); $Event_Name = ($Event_info['Event_Type']); } //gather the Events $get_Event_sql = "SELECT Verses.ID AS versesID, Verses.Verse, Verses.Sub_Type, Verses.Event, Events.ID AS eventsID, Events.Event_Type, Event_Sub.ID AS event_SubID, Event_Sub.Event_Sub_Type FROM Verses LEFT JOIN Events ON Verses.Event = Events.ID LEFT JOIN Event_Sub ON Verses.Sub_Type = Event_Sub.ID WHERE Verses.Event = '".$_POST["Event_Type"]."' ORDER BY Verses.ID ASC"; $get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli)); //create the display string $display_block = " <p> The Event Type is <b> '".$Event_Name."'</b> </p> <table width=\"70%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" > <tr> <th>ID</th> <th>VERSE</th> <th>MOOD/SUB TYPE</th> </tr>"; while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Verse_id = $Verse_info['versesID']; $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; //add to display $display_block .= " <tr> <td width=\"1%\" valign=\"top\">".$Verse_id."<br/></td> <td width=\"55%\" valign=\"top\">".$Verse_text."<br/></td> <td width=\"35%\" valign=\"top\">" .$Mood_info."<br/></td> </tr>"; } //free results mysqli_free_result($get_Event_res); mysqli_free_result($verify_Event_res); //close connection to MySQL mysqli_close($mysqli); //close up the table $display_block .= "</table>"; } ?> <html> <head> <title> List of Verses</title> </head> <body BGCOLOR="#87CEEB"> <h1>Verses</h1> <FORM METHOD="LINK" ACTION="Size_Menu.html"> <INPUT TYPE="submit" VALUE="Go To Print Utility"> </FORM> <?php echo $display_block; ?> </body> </html>
-
I have just found by using >> print_r($_POST); I can see what is in the array. It prints 255215000, so why does $color not pick up this number and use it to extract the characters??
-
Firstly I was not sure whether to put this in HTML or PHP forum! I have some code that I wish to input into the PHP script, using $POST. Here is the HTML code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <title><!-- Insert your title here --></title> </head> <body> <form action="testcolor.php" method="post"> <input type="checkbox" name="textcolor" value="255215000" /> Gold<br /><br /> <input type="submit" value="Submit"/> </form> </body> </html> As you can see the name of the variable is 'textcolor' and its value is '255215000' The PHP code takes this number and using SUBSTR extracts each group of three characters. The purpose of this is to split the string up into 3 variables r, g, b, to input this as a colour in fpdf. Here is the PHP code: <?php echo $POST[textcolor]; $color = $POST[textcolor]; $r = substr($color,0,3); $g = substr($color,3,3); $b = substr($color,6,3); echo $r; echo $g; echo $b; ?> I put the echo in to see if it would output the input from the HTML script, but I just get a blank screen. I know that the SUBSTR part works as I have substituted the intended string and got the $r, $g, $b values output. There is obviously something wrong with the $POST command, but I can not see where I am going wrong> Can anyone help?
-
AHH! I always fall for that one! It's my age! No so young as I feel! My brain is siezing up I think.
-
When I typed in $Event_id = $Verse_info['VersesID']; all I get is a blank field in the table??
-
Sorry! I am thick. Where do you set up the array called $row?
-
Thanks again Jesi! As my knowledge is limited or I'm just plain thick today, can you show me the syntax for the $row['versesID']. The code below gives an error: Fatal error: Function name must be a string in C:\websites\Test\MshowType.php on line 50 while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Event_id = $Verse_info($row['VersesID']); $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; If not perhaps I misunderstood your last sentance. Thanks again!
-
Thanks Jesi that was very helpful, but I still have a problem! I have managed to get most of the information onto the table, but I need to display the ID in the verses table and for some reason I get the ID from the Event_Sub table, even if I qualify the table name (Verses.ID). Can anyone spot where I am going wrong? Here is the code: $get_Event_sql = "SELECT Verses.ID, Verses.Verse, Verses.Sub_Type, Verses.Event, Events.ID, Events.Event_Type, Event_Sub.ID, Event_Sub.Event_Sub_Type FROM Verses LEFT JOIN Events ON Verses.Event = Events.ID LEFT JOIN Event_Sub ON Verses.Sub_Type = Event_Sub.ID WHERE Verses.Event = '".$_POST["Event_Type"]."' ORDER BY Verses.ID ASC"; $get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli)); //create the display string $display_block = " <p> The Event Type is <b> ['Event_Sub.Event_Type']</b> </p> <table width=\"50%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" > <tr> <th>ID</th> <th>VERSE</th> <th>MOOD</th> </tr>"; while ($Verse_info = mysqli_fetch_array($get_Event_res)) { $Event_id = $Verse_info['Verses.ID']; $Verse_text = nl2br(stripslashes($Verse_info['Verse'])); $Mood_info = $Verse_info['Event_Sub_Type']; //add to display $display_block .= " <tr> <td width=\"1%\" valign=\"top\">".$Event_id."<br/></td> <td width=\"35%\" valign=\"top\">".$Verse_text."<br/></td> <td width=\"35%\" valign=\"top\">" .$Mood_info."<br/></td> </tr>"; } //free results mysqli_free_result($get_Event_res); mysqli_free_result($verify_Event_res); //close connection to MySQL mysqli_close($mysqli); //close up the table $display_block .= "</table>"; } I hope someone can help as I have exhausted my knowledge.
-
I am trying to write a query in PHP on a MYSQL database to retrieve data from more than one table. My database is a database of greetings card verses and is made up of 3 tables. VERSES -ID=int>>PK -Event=int -Sub_Type=int -Verse=varchar EVENTS -ID=int..PK -Event_Type=varchar EVENT_SUB -ID=int>>PK -Event_Sub_Type=varchar A previous script uses $POST to identify which Event_Type is chosen and from the array it will show the ID number for the EVENT_SUB and therefore it will also mean that I can use the Event_Sub_Type in the output to the screen. In have looked at JOINS, but can not see how you write a JOIN which uses 3 tables. Once I get the logic for the SELECT QUERY right I should be able to change the PHP code to suit. Can anyone help?
-
Hi Ivan That would through all the positioning I have carefully worked out. Just to elabourate, I am trying to produce a utility to print out greetings inserts for handmade cards. The position that it prints out is critical, as for an A5 portrait insert it must print Landscape in the righthand half of the page and so it looks right it is centred with the box. This part is working OK! I just need to orientate the page. I have just found a php script to output as PDF, so I am investigating this! Thanks for your help! Rocky48
-
Hi Ivan Actually someone from another forum came up with the answer to the Font problem - It was solved by changing the font size to pt (point). However I still do not have any answer to how to get it to print in the right orientation. Have you any ideas? Rocky48
-
I am extracting a string from a MySQL database using a PHP script to query the database and within this PHP code embeded in it is some HTML code to display and print it out. It is important where it is printed on the sheet of paper, so I have written some CSS code to control its position size and orientation. The code recognises the Font face, but ignores the size I have specified. Also I need to set the paper orientation but it ignores this as well. I am not sure about the syntax in the HTML code for the orientation. Can anyone help me? CSS script: /*--Print stylesheet*/ .cc01 { /* Common */ font : 24px 'French Script MT'; color : #000000; } @page port {size: portrait;margin: 0cm} @page land {size: landscape;margin: 0cm} div#Text { /* <DIV>Text</DIV> */ position : absolute; left : 0.8cm; top : 13.5cm; width : 10.0cm; height : 5.5cm; } Here is the HTML portion of the PHP script: <html> <head> <link rel="stylesheet" type="text/css" href="Prn_Scrn120SQL.css" media="screen"> <link rel="stylesheet" type="text/css" href="print120SQL.css" media="print"> <title> List of Verses</title> </head> <body {page: land}> <div id="Text" class= "cc01" align="center"> <p> <?php ECHO $display_block; ?> </p> </div> </body> </html>