Okay, I'm trying to make a PHP script that will alow me to enter information for a manga (i.e.: How many pages it has, chapters, etc...) and from that information, it will create HTML pages equal to the number of pages it has. Now the problem I seem to be running into, is that It will create the first page perfectly, but the second and subsequent pages will be created without the list values being there. Another problem I'm having, is that down near the bottom, when it's creating the onClick javascript code for the "Next Page" button, on the last page it shouldn't have anything in between the parenthesis, but before that, it should have the page number. The problem is, it doesn't put the page number at all. The same goes for the "Previous Page" button, but instead it doesn't put any numbers in the parenthesis after the first page. The code for the page with the forms entitled mangaCreatorForm.php:
<!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>
<form action="mangaCreator.php" method="get">
What Manga is this for: <input type="text" name="mangaName" /><br />
What chapter is this for: <input type="text" name="chapNum" /><br />
How many Chapters are there TOTAL: <input type="text" name="chapVal" /><br />
What volume is this: <input type="text" name="volNum" /><br />
How many volumes are there TOTAL: <input type="text" name="volVal" /><br />
How many pages are there: <input type="text" name="pageNum" /><br />
<input type="submit" name="Submit" value="Submit"/>
</form>
<body>
</body>
</html>
And the and the second page entitled mangaCreator.php (it's probably really unstructured, so don't give yourself a headache looking at it):
<?php
$i1 = 0;
$i2 = 0;
$i3 = 0;
$i4 = 0;
while ($i1<$pageNum){
$i1++;
/*
$thisdir = getcwd();
if(mkdir($thisdir ."/testDocs" , 0777))
{
echo "Directory has been created successfully...";
}
else
{
echo "Failed to create directory...";
}
*/
//Write to file
$ourFileName = testDocs."/".page.$i1.".".html;
$fh = fopen($ourFileName, 'w') or die("Can't open file");
//What to write
$stringData = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>';
fwrite($fh, $stringData);
if ($chapNum=="Cover" || $chapNum=="cover"){
$stringData = $mangaName.': Volume '.$volNum.' Cover - Page '.$i1;
fwrite($fh, $stringData);
}else{
$stringData = $mangaName.': Chapter '.$chapNum.' Page '.$i1;
fwrite($fh, $stringData);
}
$stringData = '
</title>
<body>
<link rel="stylesheet" type="text/css" href="../../../Javascript+Others/CSS.css"/>
</head>
<script type="text/javascript" src="../../../Javascript+Others/javascript.js"></script>
<body id="body">
<table id="navBarTable">
<tr>
<td id="navBar"><span class="navBarHyperlink"> <a href="../../../MangaIndex.html">Home</a><span class="style3"> | </span><a href="../../../../Index.html">Back to Index Page</a></span></td>
<td id="dropDownBar1" align="right">
<select name="mangaSelect" id="mangaSelect" onChange=window.location="../../../"+this.value>
<option value="" selected="selected">Select Manga Series...</option>
<option value="+Anima/Volume1/Cover/page01.html">+Anima</option>
<option value="Digimon_D-Cyber/Volume1/Cover/page01.html">Digimon D-Cyber</option>
<option value="Flame_of_Recca/Volume1/Chapter1/page01.html">Flame of Recca</option>
<option value="Kashimashi/Volume1/Cover/cover.html">Kashimashi</option>
</select>
</td>
</tr>
</table>
<br />
<div align="center"><span class="style1">';
fwrite($fh, $stringData);
if ($chapNum=="Cover" || $chapNum=="cover"){
$stringData = 'Volume '.$volNum.' Cover - Page '.$i1;
fwrite($fh, $stringData);
}else{
$stringData = 'Chapter '.$chapNum.' - Page '.$i1;
fwrite($fh, $stringData);
}
$stringData = '</span><br />
<strong>Skip to:</strong>
<select name="chapterSelect" id="chapterSelect" onChange=window.location="../"+this.value+"/page01.html">';
fwrite($fh, $stringData);
while ($i2 < $volVal){
$i2++;
$stringData = '
<option value="Volume'.$i2.'Cover"';
fwrite($fh, $stringData);
if ($chapNum=="Cover" || $chapNum=="cover"){
if ($i2==$volNum){
$stringData = ' selected';
fwrite($fh, $stringData);
}
}
$stringData = '>Volume '.$i2.' Cover</option>';
fwrite($fh, $stringData);
}
while ($i3 < $chapVal){
$i3++;
$stringData = '
<option value="Chapter'.$i3.'"';
fwrite($fh, $stringData);
if (is_int($chapNum)){
if ($i3==$chapNum){
$stringData = ' selected ';
fwrite($fh, $stringData);
}
}
$stringData = '>Chapter '.$i3.'</option>';
fwrite($fh, $stringData);
}
$stringData = '
</select>
<select name="pageSelect" id="pageSelect" onChange=window.location="page"+this.value+".html">';
fwrite($fh, $stringData);
while($i4<$pageNum){
$i4++;
$stringData = '
<option value="'.$i4.'"';
fwrite($fh, $stringData);
if ($i4==$i1){
$stringData = ' selected';
fwrite($fh, $stringData);
}
$stringData = '>Page '.$i4.'</option>';
fwrite($fh, $stringData);
}
$stringData = '
</select>
</div>
<br />
<div align="center">
<img src="Images/';
fwrite($fh, $stringData);
$stringData = $i1;
fwrite($fh, $stringData);
$stringData = '.png" />
</div><br />
<div align="center">
<input type="submit" name="buttonPrevious" id="buttonPrevious" value="Previous Page" onClick="previousPage(';
fwrite($fh, $stringData);
if (!$i1==1){
$stringData = $i1;
fwrite($fh, $stringData);
}
$stringData = ');"/> <input type="submit" name="buttonNext" id="buttonNext" value="Next Page" onClick="nextPage(';
fwrite($fh, $stringData);
if (!$i1==$pageNum){
$stringData = $i1;
fwrite($fh, $stringData);
}
$stringData = '
);"/></div>
<div id="copyrights">All Manga, Character Designs and Logos are © to their respective copyright holders.</div>
</body>
</html>';
fwrite($fh, $stringData);
fclose($fh);
}
?>
<a href="testDocs/page1.html"> Test </a>
Here's the link to the first page the creator outputs: http://wishlist.digitalawakening.co.cc/PHPTest/testDocs/page1.html .
Thank you for your time, and if you need me to re-explain anything, just ask.