Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. From looking at your code, the secound if is checking whether $restrict is equal to "all", it is not checking whether $page is equal to "all", only the first if is checking the value of $page. Also I have no idea why you're getting the undefined function error message. You are sure that you havn't mistyped the name of the function? Also with your require/include statements you can use relative paths rather then full paths.
  2. Is this a result from an ODBC query? If it is you can use odbc_fetch_rows function, which is the same as mysql_fetch_rows, but works with odbc instead.
  3. That is incorrect, idealy it should be this: [code]// check that $_POST['s1'] isset and that $_POST['s1'] is not empty if (isset($_POST['s1']) && !empty($_POST['s1'])){ //name of field 1      $MailBody = "Name :$_POST['s1']; }[/code] That code replaces this: [code]if ($s1 == ""){ //name of field 1 } else {      $MailBody = "Name :$_POST['1'] //This value is inserted inthe mailbody:$_POST['1'] }[/code]
  4. When ever you use sessions you will need to have session_start as the first line for each page that uses sessions.
  5. Supply some code and we might be able to help. How are you creating the message part of the email?
  6. Oops, typo! All corrected
  7. You cant. If you want a popup it has to be in javascript. PHP works on the server it has no control over the webbrowser.
  8. wildteen88

    html help

    Dont post the same thread in the html forum I'll move this.
  9. You dont have to use forms to send data to the server/PHP. You can use hyperlinks and/or forms to send GET data, but only a form for POST data, for example when you want to send GET data you can use hyperlinks: [code]<?php if(isset($_GET['say'])) {     echo "You have sent the following: <i>" . $_GET['say'] . "</i><br />"; } ?> Say: <a href="?say=how are you">How are you</a> | <a href="?say=I'm fine!">I'm fine!</a> | <a href="?say=No need for forms!">No need for forms</a>[/code] Click each link and you'll get a message. Notice how the url changes evey time you click a link. The text after the ? is called a [b]query string[/b]. You should only send data over the url for non-sensitive data, such as sending an id of a product to a PHP script which retrieves all the info for that product. Never send say a persons password over the url use sessions or POST method on the form etc. PHP_SELF is a predifined variable which gets the full path to the current working file/directory. You can use PHP_SELF as a shortcut for not having to type in the path of the file manually, you'll probably see this used on forms. The number one fundermental rule you should follow when dealing with user input is validate user input! Never trust what a user inputs into a form field. If you dont validate user input and you using raw POST'd data into an sql query then a malicous user can perform SQL Injection attacks, whcih could be used to currupt your database, get user/customer details etc. Theres a few for now, I would expect others will add their two cents in too.
  10. Sorted your problems out. [code]$newLine = "/n"; echo "The infomation you entered is as follows.  If it is incorrect, please re enter the information <a href = 'Emails.php'>here</a><br><br>"; foreach($_POST as $field => $value) {     if(empty($_POST[$field]))     {         echo "You left the <font color = 'red'>$field</font> field empty.  If you want to submit the request please go back         and fill in this field,  <br><br>";         echo "<a href = 'Emails.php'>click here to restart request</a>";         echo "<br><br>";     } } if($_POST['Email'] != $_POST['Email-confirm']) {     echo "Your Email was not correctly confirmed, please make sure that you enter the same Email in both fields.<br><br>"; } else {     echo "The information you gave was:<br><br>";     echo "$_POST[First_Name], ";     echo "$_POST[Last_Name]<br>";     echo "$_POST[Age] yrs old<br><br>";     echo "$_POST[Email]<br><br>";     echo "$_POST[Reason]"; }[/code] Your had an extra un-needed closing } braket in your code.
  11. When you go to make a donation you should goto [a href=\"https://www.paypal.com/cgi-bin/webscr\" target=\"_blank\"]this page[/a]. Dont fill in the form on the right, just the billing form on the left. Click continue review your information. After that it should send the transaction and provide a reciept. Or is it asking you to signup when you press continue. If it is then phpfreak cant change that. Also I'm moving this to the PHPFreaks.com help forum.
  12. I told you twice! POST the code for your forl oop! The bit I told you to change was just a suggestion, it wasnt a soloution.
  13. Plase note when posting functions, place a space between the function name and the opening parenthesis, like so: [code]fopen (... blah ...);[/code] Whenyou do that the forum will allow you to post.
  14. Whats a mess! redarrow I suggest your go back to the manual and readup on if/elseif/else statements! As this: } else { $_GET['accessories']; does nothing! Also soccerstar22003 you might be better of with a switch statment instead: [code]<?php // check that p is set in the URL if (isset($_GET['p'])) {     // now we include the correct page     switch($_GET['p'])     {         case 'home':             include 'home.html';         break;         case 'contacts':             include 'contacts.html';         break;         case 'reminders':             include 'reminders.html';         break;         case 'accessories':             include 'accessories.html';         break;         case 'contactus':             include 'contactus.html';         break;         default:             include 'home.html';         break;     } } ?> <a href="?p=home">Home</a> | <a href="?p=contacts">Contacts</a> | <a href="?p=reminders">Reminders</a> | <br /> <a href="?p=accessories">Accessories</a> | <a href="?p=contactus">Contact Us</a> | <a href="?p=contactus">Contact Us</a>[/code]
  15. No thats not the solution! I need you to post your for loop code here.
  16. Can you post the code for the for loop. As the code you have provided is fine. Also make sure you place apostrophes ' around your indexes for your arrays like so: [code]if($_POST['Email'] != $_POST['Email-confirm'])[/code]
  17. You can only bring up an alert message with javascript. You can probably do someting like this: [code]if($item_warranty <= 30) {     echo '<script type="text/javascript">a lert("Warranty expires in 30days!");</script>'; }[/code] Note, remove the space between the a and l in the code above.
  18. About the big gap I was talking about the mass of < br /> tags, which creates a big empty gap.
  19. You cant echo $result in its raw state. You have to use a function like mysql_fetch_array in order to get the results. $result justs stores the result resource which is loaded into memory. So if you do this: [code]$rows = mysql_fetch_array($result); echo print_r($rows);[/code] You'll now see your results.
  20. \n creates a newline, do you want to us \n as-is, ie not make a newline, if you do then use this: \\n (two forward slashes) PHP will then use \n as-is, it will not convert \n to a newline.
  21. Umm, much better! Browser was serving your site from my browsers cache. Yeah much better text is more readabale. One thing I dont like is the bottom of your page after the [i]Contributed Debugging Tips[/i] section. Fort some odd reason there is a huge ugly blank gap aswell which I dont see much point of and your page goes to the right too! You migh want to set a width for your body tag, such as 80%; So your page content only spans 80% of the screen widith then with the following css: [code]body {     background:#0080C0;     font-family: arial;     /* center page on screen */     width: 80%;     margin: 10px auto; }[/code] and add a valid doctype: [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">[/code] Your page should be nicely centered on the screen.
  22. Well nothing changed! its till the same. I look at you style sheet it looks like you've created a class called .header yet in your html your not using! You should change your body definition to this: [code]BODY {     background:#0080C0;     font-family: arial; }[/code] But at the mement the styles you've defined in your stylesheet you're not using!
  23. I cant see anu difference! What you changed?
  24. No problem! Any problems please post back. Regex is quite hard to get around but is fun to use and learn. Regex is very powerful. It is used in a lot of applications, and programming lanaguages.
  25. Okay change this: [code]list ($id, $price, $qty) = explode (" ", trim($row[$i]));[/code] to the following: [code]// swap mulitple spaces with just one space $row[$i] = preg_replace("/(\s+)/", " ", $row[$i]); // this gets each column from the row! list ($id, $price, $qty) = explode (" ", trim($row[$i]));[/code]
×
×
  • 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.