Jump to content

doni49

Members
  • Posts

    515
  • Joined

  • Last visited

Everything posted by doni49

  1. [quote author=pouncer link=topic=115013.msg468152#msg468152 date=1163548572] include '../includes/template_banner.html'; ......... .........but it just doesnt put that flash banner on the forum.php for some reason. All I see is a white space. [b]Works on other pages though which are outside the 'forum' folder[/b] [/quote] So you're saying that www.domain.com/myftp/forum/forum.php DOESN'T display the banner but www.domain.com/myftp/index.php WOULD dispaly the banner? You're telling the server to "go from my current location UP one folder and look for template_banner.html".  So what folder is this file IN?
  2. The first time through, concatenate a null string and a random string.  Then the second time, it's got the value of the previous run.  It' works on SOME servers because the error reporting settings are lower on some servers. it could be fixed (causing no errors) by adding $pass = ""; above the start of the while loop. That way it wouldn't be a NULL string.
  3. It's called Troubleshooting and Debugging.  Break it down into little steps. You seem to be having trouble pulling a text string from your DB and using the eval function to read the string and create a function that works. First get eval to create a function that you can use.  Then try storing that string in the DB.  If it's not working now, what would you do differently with a flat file?  If you know the answer to that, you should be able to get it working with the DB.
  4. for the first one, put the following in a php file all by itself, put it on your server and load it in your browser. <?php phpinfo(); ?> I don't know anything about the others.
  5. Your test message arrived in my email. [quote] This is the test! [/quote]
  6. in your php file.
  7. if your arrays are formated exactly as you've shown then this should do it for you: [code] $allCars[]="6145|Jones Jeep|Red|Truck"; $allCars[]="5542|McDaniel Chevrolet|Green|Sedan"; $allCars[]="7765|Matthews Chevrolet|Green|Van"; $allCars[]="2234|James Dodge|Blue|Truck"; $allCars[]="6612|Smith Nissan|Black|Sedan"; $carList = asort($allCars); [/code] And if you want to pull out a certain piece of info about one of the car: $car = explode("|", $carList[1]); echo "Dealership Name:  " . $car[1]; This will be sorted by dealership number and for any dealerships with multiple cars listed, will be sorted within those groups based on the color then on model type.
  8. to boil it down a little: [code] <?php include('header'); if (isset($_POST['Submit'])){  //  <--if this is true, then the form was submitted   $validForm = TRUE;//                <--later we'll see if this is still true   validate the form--if something is wrong in any field, then   tell visitor there was a problem and what field it's in and   change $validForm to FALSE     if($validForm){     Perform the form's tasks (in this case, send the message)     Thank the visitor     include('footer');     exit();  //quit further processing   }else{     Tell visitor to try again.   } } this runs if $_POST['Submit'] is not set OR if $validForm was FALSE; HTML code of the form include('footer'); [/code]
  9. [quote author=pthurmond link=topic=114879.msg467565#msg467565 date=1163464493] The problem with that is how do you handle the situation that they need to try again? Even if the second page has the form in it too the user could and eventually probably will mess up on the entry again. I need a way to be able to infinitely show the page again if they messed up. [/quote] This does EXACTLY that.  Try it for yourself. EDIT:  URL REMOVED.
  10. Unless you "pass" the varaibles to the next page, YES they're gone. There are three ways to "pass" variables from one page to another. Read up on Sessions, Post and Get.
  11. Do you mean 18 People?  Or 18 keys (name, age, pet being three of the keys)?  If 18 people then the same code that you have should do it. And if you have control over this string, can you format it a little differently?
  12. I have it in two seperate files. contact.php [code] <?php $pgTitle = "Contact Us"; include("header.inc"); //phpinfo(); ?> <?php include("contact.inc"); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table>   <tr> <td align="right"><b>Name*:</b></td><td><input type="text" name="first_name" size="50" maxlength="15" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name'];?>" ></td>   </tr>   <tr> <td align="right"><b>Email Address*:</b> </td><td><input type="text" name="email" size="50" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" > </td>   </tr>   <tr>     <td align="right"><b>Subject*:<b></td><td><input type="text" name="subject" MAXLENGTH="50" SIZE="50" value="<?php if (isset($_POST['subject'])) echo $_POST['subject']; ?>"></td>   </tr>   <tr>     <td align="right" valign="top"><b>Comments:</b></td><td><TEXTAREA name="msgBody" VALUE="<?php if (isset($_POST['msgBody'])) echo $_POST['msgBody']; ?>" ROWS=10 COLS=40></TEXTAREA></td>   </tr>   <tr> <td colspan="2"><div align="center"><input type="submit" name="submit" value="Submit">&nbsp;&nbsp;<input type="submit" name="reset" value="Start Over" /></div></td>   </tr> </table> </form><!-- End of Form --> <?php include("footer.inc"); [/code] contact.inc [code] <?php function escape_data($data){ global $dbh; if (ini_get('magic_quotes_gpc')){ $data = stripslashes($data); } return $data; } if (isset($_POST['submit'])) { // Handle the form. $validForm = true; // Check for a first name. if (eregi ("^[[:alpha:].' -]{2,50}$", stripslashes(trim($_POST['first_name'])))) { $fn = escape_data($_POST['first_name']); } else { $fn = FALSE; $validForm = false; echo '<p><font color="red" size="+1">Please enter your first name!</font></p>'; } $email = true; // Check for an email address. if(!empty($_POST['email'])){ if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email'])))){ $e = escape_data($_POST['email']); } else { $validForm = false; echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>'; } }else{ $email = false; } // Check for a subject. if (!empty($_POST['subject'])) { $u = escape_data($_POST['subject']); } else { $u = FALSE; $validForm = false; echo '<p><font color="red" size="+1">Please enter a valid subject!</font></p>'; } if ($validForm) { // If everything's OK. $headers = "From:  " . $fn . " <" . $e . ">\r\n"; mail($webmaster_email, $u, $_POST['msgBody'], $headers); echo '<br>Thank you for taking the time to contact me. I will respond as soon as possible.<br><br><br><br><br>'; include ('footer.inc'); // Include the HTML footer. exit(); } else { // If one of the data tests failed. echo '<p><font color="red" size="+1">Please try again.</font></p>'; } } // End of the main Submit conditional. [/code]
  13. You can also do almost what you did in your original message if($password1 != $password2 OR $password1 == "") { echo "Password Blank or Not Equal"; }
  14. [quote author=ksb24930 link=topic=114760.msg467312#msg467312 date=1163434127] okay, so don has helped me out a lot. This code looks like exactly what I need. I copy/pasted it into my page and nothing comes up. i don't think the loop is even starting. doni, where you at? $count_sql = 'SELECT * FROM imagec'; $result = mysql_query($count_sql); $num=mysql_numrows($result); for($i=0;$i<num;$i+4){   echo "<tr>";   for($j=0;$j<4;$j++){         $id=mysql_result($result,$i+$j,"image_id");     echo "<td width='' bgcolor='' align='' valign=''>";     echo "<a href=index.php?iid=$id&tbl=imagec><img src='image.php?iid=$id&tbl=imagec' width=100 height=73 ><" . "/a" . "></td>";   }   echo "</tr>"; } [/quote] I was at work--day job ya know. just above the start of the for loop: [code] echo "<br />Num Value:  " . $num; [/code] Edit:  I'm also still curious about that SEEMINGLY extra TD--it doesn't seem to have a purpose and it doesn't seem to have a closing tag.
  15. Can you show the code as you tried it?  Try it using the code above and go from there.  Once you get that simple code working, you can worry about pulling it from the DB to use it.
  16. You could also pass the variable as part of the URL. file1.php: [code] echo '<a heref="www.server2.com/file2.php?var1=' . $var1 . '&var2=' . $var2 .'>Link to other server<' . '/a' . >';  [/code] file2.php [code] echo "Var 1:  " .  $_GET['var1']; echo "Var 2:  " .  $_GET['var2']; [/code]
  17. So you're saying the function definition is IN the DB? If you have something like $ftest = "function test(){echo "Hello"}; The following should make the function available: [code] eval($ftest); [/code] and therefore the following should display [b]Hello[/b] in your browser: [code] test(); [/code] NOTE:  I have NOT tested this myself but it should work.
  18. Nicklas, I did that when I was testing his code.  NOTHING was sent to the browswer--not even an error message. But the code that I posted DID work. EDIT:  I don't know how to explain this one, but I put the following in a php file (all by itself) and uploaded it.  When I ran it, it worked.  I could swear that I had the same thing yesterday (looks the same to me). [code] <?php $decimal = "8571428571"; $rdays = '' . $decimal / "14.285714285"; echo "<br />Line1<br>"; echo $rdays[0]; echo "<br />Line2<br>"; ?> [/code] This is what my browser shows: [quote] Line1 6 Line2 [/quote]
  19. The only other possiblity that [b]I[/b] can see is that maybe the file doesn't exist (remember *nix filesystem is case sensitive--ITWORKS.txt isn't the same as itworks.txt.  Or there is a problem with your permission settings. Try this above the call to your function: if(file_exist("/opt/lampp/htdocs/logs/") && is_dir("/opt/lampp/htdocs/logs/")){   dir("/opt/lampp/htdocs/logs/") }else{   echo "Folder missing";   dir("/opt/lampp/htdocs/") }
  20. Try this on for size: [code] for($i=0;$i<num;$i+4){   echo "<tr>";   for($j=0;$j<4;$j++){     $id=mysql_result($result,$i+$j,"image_id");     echo "<td width='' bgcolor='' align='' valign=''>";//What's this TD for ?  And there's no matching </td>     echo "<td><a href=index.php?iid=$id&tbl=imagea><img src='image.php?iid=$id&tbl=imagea' width=100 height=73 ><" . "/a" . "></td>";   }   echo "</tr>"; } [/code]
  21. is that copy/pasted? the while loop checks $l (lower case L) not $i.  Dunno if that's your problem, but.......
  22. Then you need to do the query before each item.  Otherwise the variables aren't changing.
  23. http://us2.php.net/manual/en/ref.filesystem.php check out the following functions at the above link:  1) file_exists 2) is_dir 3) mkdir
  24. In the form: <p>One Date per Line</p> <input type="textarea" name="dates" cols="20" rows="5"> Then in script: $dates = explode("\n",add_slashes($_POST['dates']));
  25. Also, in looking at your original post above, I gotta wonder, are you INTENDING to show three links ALL the same and ALL the same image?
×
×
  • 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.