Jump to content

hansford

Members
  • Posts

    562
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by hansford

  1. if in the DB theres an actual file ie: imagefile01.jpg then try: $img = $user[content]; echo "Photo: " . "<img src='" . $img . "'>";
  2. yeah but the other page would have to redirect back to the first page. And the user would have to instigate a return back to this page because-I assume you want them to read that the site is being updated. On the second page just let them read your message and then have a link below it saying return to homepage. on page1 you could do: ------------------------------- $page = "/nextpage.php"; echo "<html><body onload=\"window.location='$page'\">"; echo file_get_contents ("http://www.malegroomingfordummies.co.uk/controlPanel/setInStock.php"); echo file_get_contents("http://www.malegroomingfordummies.co.uk/controlPanel/setPrice.php"); echo </body></html>
  3. Where in the code do you ask it to show an image? should be something like echo "<img src='.....
  4. That worked like a charm - thank you.
  5. need a pattern for an entire anchor tag containing specifically this URL: http://www.sedoparking.com or http://www.sedoparking.complusanystringattached ------------------------- <a href='http://www.sedoparking.com'>whatever is here</a> <A HREF='http://www.sedoparking.com'>whatever is here</A> <A HREF="http://www.sedoparking.com">whatever is here</A> <a href="http://www.sedoparking.com">whatever is here</a> <a href = 'http://www.sedoparking.com' >whatever is here</a> ----------------------------- $fil = file_get_contents('http://www.frozen.com');` $find="/<[aA]\s*[ahrefHREF]*\s*=\s*[\"\']http:\/\/www\.sedoparking\.com.*[\'\"]\s*>.*<\/[Aa]\s*>"; $ret = preg_match_all($find, $fil, $matches, PREG_SET_ORDER); echo $ret; // returns 0 any input or advice would be appreciated.
  6. Well forget ajax - it's not needed here since you want to go directly to another page. This is a javascript example. The <option value='india' or whatever you want to call it would be the name of the page that contains the states ie: 'india'. The javascript function will add it's ending ie: '.php' or '.html' -------------------------------------- <html> <body> <?php echo "<form name='formcountries' method='post' action=''>"; echo "<select name='countries' onchange='getstates(this.form)'>"; echo "<option value='india'>India</option>"; echo "<option value='africa'>Africa</option>"; echo "<option value='america'>America</option>"; echo "</select></form>"; ?> <script language='javascript'> function getstates(frm){ var box = frm.countries; var value = box.options[box.selectedIndex].value; window.location.href= eval('"http://www.youraddress.com/' + value + '.php"'); } </script> </body> </html>
  7. Not quite sure what you mean -you can upload an image, text etc.. and display the image, text, etc.. on the same page. If(isset($_POST['uploadimageform'] { //connect to database and save file or connect to database and open file //display image, text whatever.. } else{ // echo upload form }
  8. Please, Be more specific in exactly what youre wanting to do.
  9. Javascript and ajax can do this without reloading or submitting the page-ie a redirect. How to do this-? well, you'll have to wait til tomorrow when I sober up hehe
  10. This tells use nothing - What is it exactly that you want? Provide any relevent code.
  11. This type of code would be inside index.php ----------------------------------------- include('header.php') if(isset($_GET['page'])){ switch($_GET['page']){ case 1 : include('page1.php'); break; case 2 : include('page2.php'); break; case 3 : include('page3.php'); break; default: include('main.php'); } else{ include('main.php'); } } include(footer.php);
  12. yeah you're going to have problems with that long a string. you should try to match the first part of the string, wildcard everything in between and match the last part of the string.
  13. exactly - like this for($i = 0; $i < $repeatlength; $i++) { $modrand = rand(0, ($modcount - 1)); $randommod = ($modarray[$modrand]); fwrite($fh, $variable1 . "," . $variable2 . "," . $variable3 . "," . $randommod . "," . $variable4 . "," . $variable5 . "\r\n"); }
  14. I like using an index page to process all pages. The index will have your site map, menu, header, footer etc.. and then include('page2') etc.. so the answer to your question is no - its not pointless - it's smart web development. Of course a better idea is using a template based system-ie: CMS -the idea being that we want to seperate code from html and other design processes. The designers can do their thing and not mess up our code and we can do our thing and not have to sift through all of that CSS and HTML and figure out where to place our code.
  15. need some javascript for this. Heres an example. All it does is disables whatever boxes don't have text in them. ------------------- <html> <body> <center> <form name="uploadform" enctype="multipart/form-data" method="post" action=<?php $_SERVER[php_SELF] ?> Choose a file to upload:<input type="file" name="file01"/><br> Choose a file to upload:<input type="file" name="file02"/><br> Choose a file to upload:<input type="file" name="file03"/><br> <input type='button' value='submit' onclick='validate(this.form)'> </form> </center> <script language='javascript'> function validate(frm){ var imagearray = new Array(); for(var i = 0; i < (frm.length - 1); i++){ if(frm.value == ""){ frm.disabled = "true"; } }
  16. you shouldnt need the base address. If I'm putting an image tag in html I do like this because the server already knows the base. <img src="./images/img03.jpg" width='125' height='50'>
  17. sometimes the hard way is the better option - it never fails. With eregi_replace() you're relying on the code of another person. PHP is full of quirks and bugs-it doesn't matter- there is always another way to get from point A to B. $str="165890456732245"; $number = ""; for($i = 0; $i < strlen($str); $i++){ if(is_numeric($str[$i])){ $number .= $str[$i]; if(!is_numeric($str[$i + 1])){ break; } } } echo $number;
  18. Im just glad we got it fixed. I re-did your code minus the database stuff to try and see what you were seeing - this works. ---------------------------------- $res_name = "2.jpg"; $display = ""; for($i = 0; $i < 10; $i++){ $display .= "document.write('<tr><td width=\"130\"><img src=\"../resources/images/$res_name\"></td><td>$res_name</td></tr>');"; } Header('content-type: application/x-javascript'); echo "document.write('<table>');"; echo $display; echo "document.write('</table>');";
  19. heres some simple code replace the image directory and imagename with your files and see if it displays -------------------- heres the writescript.php code ----------------- <?php $doc = "document.write('<img src=\"./images/2.jpg\">');"; Header('content-type: application/x-javascript'); echo $doc; ?> ------------------ heres the writescript.html code ------------------------ <html> <body> <script type="text/javascript" src="writescript.php"></script> </script> </body> </html>
  20. heres the javascript way. This is just the general idea of how its done using a hidden DIV <form name='form1'> <select size=1 name="listweare" onchange='javascript:checkit(this.form)'> <OPTION selected value="1">Male</OPTION> <OPTION value="2">Female</OPTION> </select> </form> <div id='list2' style="visibility: hidden"> <form name='form2'> <select size=1 name="hairsyle"> <OPTION selected value="1">Blonde</OPTION> <OPTION value="2">Brunette</OPTION> </select> </form> </div> <script> function checkit(f){ var box = f.listweare; var number = box.options[box.selectedIndex].value; if(number == 2){ el = document.getElementById('list2') el.style.visibility = 'visible'; } else{ el = document.getElementById('list2') el.style.visibility = 'hidden'; } }
  21. similar code works fine for me, but I can't get it to display if I echo the header() or if I don't use the single quotes with document.write like: $doc = "document.write('img src=\"./images/2.jpg\">');";
  22. youre going to have to let php echo it all out...the form iframe etc. $str = "<script language='javascript'>"; $str .= "<iframe name='IFRAMENAME' src='PAGENAME.PHP'></iframe>"; $str .= "<form method="POST" action="PAGENAME.PHP" target="IFRAMENAME">; then when the page is submitted back to this page have checks to see that the form has been submitted ie use $_POST if it has been submitted then you know that you dont want to echo the form
  23. ok I see what youre doing-sorry. Heres the fix: --------------------- echo "Header(\"content-type: application/x-javascript\");"; should be just the following with no echo ------------------------ Header('content-type: application/x-javascript');
  24. you must echo "<script language='javascript'>" before echoing document.write and then after all the js echo "</script>";
  25. your pattern is fine. The problem might lie in $row['ContentPartContent']; check out the results of my test. -------------- $search = "<html><body><div id='leftCol' class='editable'>My Content</div></body></html>"; $pattern = "/<div[A-Za-z0-9'= ]*id='([\S]+)'[A-Za-z0-9=' ]*class='editable'>([\s\S]*)<\/div>/"; $replace = "yadiyadi"; $str = preg_replace($pattern,$replace, $search); preg_match($pattern,$search,$matches); echo $str; //results = yadiyadi echo $matches[0]; //results = My Content
×
×
  • 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.