Jump to content

cmzone

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by cmzone

  1. Is it possible for me to have one submit button for these two different forms, or possible merge the two forms into one? not really php but I guess the POST process it... (the enctype attribute on the second form messes with the select option if I merge the two) echo 'Product '.$model.' submitted successfully!<br /><br /> Select Maker from the list and Submit the Product Picture (picture must have same name as the model name) <br /> //FIRST FORM <form action="uploader.php" method="POST"> <select name="modelmaker"> <option>Select</option> <option>Hanns-G</option> <option>Acer</option> <option>HP</option> <option>Samsung</option> <option>Viewsonic</option> <option>BenQ</option> <option>Dell</option> <option>Westinghouse</option> <option>LG</option> <option>Sony</option> </select></form> //SECOND FORM <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form>'
  2. so this will create the file if it doesnt exist? function newMonitor(array $model) { $content = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <?php include("parts/head.php"); ?> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.cycle.js"></script> <script type="text/javascript" src="js/slider.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".featured").cycle({ fx: 'fade', speed: 300, timeout: 4000, pause: 1 , next: ".right", prev: ".left" }); }); </script> <title>Computer Monitors Zone | Top Rated Flat Screen Monitors</title> </head> <body> <?php include("parts/header.php"); ?> <?php include("parts/slider.php"); ?> <?php include("parts/footer.php"); ?> </body> </html>' '; $file = 'myfile.html'; if(!file_exists($file)) { file_put_contents($file, $content); } ?>
  3. If I can echo a bunch of code shouldnt I be able to create a file with a bunch of code of my choice?
  4. I want to write this massive function that adds the product and creates a new page for my site. The top echo part works great but where I say "starting here" is where I need help. First I need to create the html page with the code, but then if the page exists I want it to do nothing at all. How would I go about doing this? <?php function newMonitor(array $model) { //Works Perfect echo '<div class="section"> <div class="images"> <img class="logo" src="images/logos/'.$model[1].'.png" alt="'.$model[1].'" /> <img class="monitor" src="images/'.$model[1].'/'.$model[0].'.png" alt="'.$model[1].' '.$model[0].'" /> </div> <div class="description"> <a href="#">'.$model[1].' '.$model[0].' '.$model[4].'" LCD Monitor</a> <ul> <li><strong>Color:</strong> '.$model[3].'</li> <li><strong>Size:</strong> '.$model[4].'</li> <li><strong>Resolution:</strong> '.$model[5].'</li> <li><strong>Response Time:</strong> '.$model[6].'ms</li> <li><strong>Input:</strong> '.$model[7].'</li> <li><strong>Brightness:</strong> '.$model[8].'cd/m2</li> <li><strong>Contrast Ratio:</strong> '.$model[9].'</li> <li><strong>Viewing Angle:</strong> '.$model[10].' (H/V) Degrees</li> <li><strong>Pixel Pitch:</strong> '.$model[11].'mm</li> </ul> </div> <div class="revieworbuy"> <a class="rr" href="'.$model[1].'-'.$model.'.html"></a> <a class="bn" href="'.$model[12].'"></a> <p>$'.$model[2].'</p> </div> <div class="clear"></div> </div>'; //STARTING HERE $myFile = "'.$model[1].$model[0].'.html"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <?php include("parts/head.php"); ?> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.cycle.js"></script> <script type="text/javascript" src="js/slider.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".featured").cycle({ fx: 'fade', speed: 300, timeout: 4000, pause: 1 , next: ".right", prev: ".left" }); }); </script> <title>New Page</title> </head> <body> <?php include("parts/header.php"); ?> <?php include("parts/slider.php"); ?> <?php include("parts/footer.php"); ?> </body> </html>'; fwrite($fh, $stringData); fclose($fh); } ?>
  5. How could I append to a php document but keep the '?>' at the end? Is this possible? Thanks
  6. no more errors but the function is not working at all. what i what to happen is when the function is called, i want the parameter to replace all the variables i specified in the function itself, and then i want the function to print the raw code onto the html document exactly where it is called. maybe this helps some more?
  7. okay then my problem is that the div isnt submitting at all, like the function isnt appearing, as if the <<<HRD is hiding everything because not even the div is showing up after calling the function what i what to happen is when the function is called, i want the parameter to replace all the variables in the code and then i want the function to print the raw code onto the html document exactly where it is called. maybe this helps some more? thanks for all your help dezkit and all
  8. ok great now no errors but not doing what I want and it was working manually by putting the code in before. Whatever I put in the variable $monitor should replace whatever I put in the code, correct? I am calling the function as so: <?php showMonitor("JW-199DPB"); ?> The multidimensional array callings should still work with those '{}' around it, right? Almost there... thanks guys!
  9. wow you guys are fast. but I have a new error. definately something to do with the multidimensional array... Error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home1/stomperg/public_html/nintendogamesonline/functions.php on line 13 Code: <?php function showMonitor($monitor) { <<<HRD <div class="section"> <div class="images"> <img class="logo" src="images/logos/hannsg.png" alt="Hanns-G" /> <img class="monitor" src="images/hannsg/$monitor.jpg" alt="Hanns-G $monitor" /> </div> <div class="description"> <a href="#">[/url] <ul> <li><strong>Color:</strong> $hannsg['$monitor'][0] </li> <li><strong>Size:</strong> $hannsg['$monitor'][1] </li> <li><strong>Resolution:</strong> $hannsg['$monitor'][2] </li> <li><strong>Response Time:</strong> $hannsg['$monitor'][3] </li> <li><strong>Input:</strong> $hannsg['$monitor'][4] </li> <li><strong>Brightness:</strong> $hannsg['$monitor'][5] </li> <li><strong>Contrast Ratio:</strong> $hannsg['$monitor'][6] </li> <li><strong>Viewing Angle:</strong> $hannsg['$monitor'][7] </li> <li><strong>Pixel Pitch:</strong> $hannsg['$monitor'][8] </li> </ul> </div> <div class="revieworbuy"> </div> <div class="clear"></div> </div> HRD; } ?>
  10. I am including a functions.php file in my index.html with one function that uses a multidimensional array data that is included as well, but I am getting an error that halts the loading of the page. Here is the error: Parse error: syntax error, unexpected T_FUNCTION in /home1/stomperg/public_html/nintendogamesonline/functions.php on line 3 And here is the code to create the function that I am including: <? php function showMonitor($monitor) { echo( <div class="section"> <div class="images"> <img class="logo" src="images/logos/hannsg.png" alt="Hanns-G" /> <img class="monitor" src="images/hannsg/$monitor.jpg" alt="Hanns-G $monitor" /> </div> <div class="description"> <a href="#"></a> <ul> <li><strong>Color:</strong> $hannsg['$monitor'][0]</li> <li><strong>Size:</strong> $hannsg['$monitor'][1]</li> <li><strong>Resolution:</strong> $hannsg['$monitor'][2]</li> <li><strong>Response Time:</strong> $hannsg['$monitor'][3]</li> <li><strong>Input:</strong> $hannsg['$monitor'][4]</li> <li><strong>Brightness:</strong> $hannsg['$monitor'][5]</li> <li><strong>Contrast Ratio:</strong> $hannsg['$monitor'][6]</li> <li><strong>Viewing Angle:</strong> $hannsg['$monitor'][7]</li> <li><strong>Pixel Pitch:</strong> $hannsg['$monitor'][8]</li> </ul> </div> <div class="revieworbuy"> </div> <div class="clear"></div> </div>); } ?> Can anyone tell me what is wrong? Thanks!
×
×
  • 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.