Jump to content

Houdini

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by Houdini

  1. Not really because what is happening is that you are assigning the value of 'test' to the variable $status regardless of what it was prior to that statement. If the $_POST['status'] was "" or nothing when it gets to $status='test' then PHP will assign the value on the right to the variable on the left whereas $status =='text' will check the value of $status and if it is 'test' then it will return true otherwise it would return false if it were"" or nothing and fail. Here is an example to illustrate what I just stated [code=php:0]<?php $status = "UH OH"; if($status==""){//remove the second = sign and retest to see the result it will execute the else statement   echo "$status contains no printable characters"; } elseif($status=="UH OH"){   echo"The proper value of $status is in the \$status variable!"; } else{   echo"The \$status variable is not correctly set."; } ?> [/code]
  2. How about maybe showing the code or the form that actually produced such an array.
  3. Keep in mind that [b]=[/b] is an assignment operator what you want when checking values of a variable or array is a comparison operator which are [b]==[/b] and [b]===[/b] but [b]== [/b]being more commonly used for a normal string variable. This is a common error by those just starting out.
  4. To use test and understand PHP (a server side language) a good start would be to set up a development environment on your local PC. You would need at least a webserver and PHP installed on your machine. Apache is free you can [url=http://httpd.apache.org/download.cgi]download it here[/url] and PHP is also download it [url=http://www.php.net/downloads.php]here[/url], having MySQL is almost a necessity for most forum software and it too is FREE. You can [url=http://dev.mysql.com/downloads/]Download MySQL here[/url]. Or if you are uncomfortable setting up a webserver PHP and MySQL on your own if using windows either get XAMPP or WAMP and with Mac get MAMP (XAMPP works for linux also) and for Linux there is LAMP. A good place to start learning PHP is with a FREE online book [url=http://www.hudzilla.org/phpbook/]Practical PHP Programming[/url]. That should get you started with PHP. Then download and test out some FREE forum software like phpBB mentioned above or SWF and there should be others, just do a search for Message boards or Forum software or BBS software.
  5. Could you show the connect doce then the database select code then the query? No one can tell from what you have posted what is wrong. Something like the below would be of great value, and also please enclose your code with [ code } and [ /code ] (without the spaces) when you post. [code]$connect = mysql_connect('localhost','username','password')   or die("Could not connect to server. MySQL said: ".mysql_error()); $select = mysql_select_db('mydatabse',$connect)   or die("Could not select database. MySQL said: ".mysql_error()); $query = "SELECT * FROM mytable where something = 'something'"; echo $query'"<br />"; $result = mysql_query($query,$connect)   or die("Your query failed because: ".mysql_error());[/code]
  6. You are using both mysql and mysqli, unless the server is PHP 5 mysqli will not work, so why do you have both? Apparently you do not have mysqli at all or it is not enabled, and with PHP 5 it is by default and mysql is disabled. show more of your code, you can't mix mysql and mysqli functions like that.
  7. This line needs changed [code]array('Server hostname', '----', 'Hostname where MySQL server is running'),[/code] to [code]array('Server hostname', 'localhost', 'Hostname where MySQL server is running'),[/code] unless you have changed the root password then [code]array('Password for config auth', '----', 'Leave empty if not using config auth', 'rosebud'),[/code] needs to be [code]array('Password for config auth', '', 'Leave empty if not using config auth', 'rosebud'),[/code]
  8. Change the config.php to this [code]<? $host = "localhost" ; $user = "root" ; $pass = "password" ; $db = "databaste" ; $connect = mysqli_connect($host , $user , $pass , $db) ; ?>[/code] And you might want to add some error checking here [code]$logquerry = mysqli_query($connect, $insert);[/code]change to this [code]$logquerry = mysqli_query($connect, $insert)   or die("Could not execute the query! MySQL said: ".mysql_error());[/code]
  9. Does it even produce an error? Or even worse does the code echo [b]You can't see me.[/b]?
  10. What you are wanting is DESCRIBE from MySQL [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]DESCRIBE[i] tablename[/i][/quote]
  11. For checking dates you could use checkdate() [a href=\"http://us3.php.net/manual/en/function.checkdate.php\" target=\"_blank\"]PHP:Manual[/a] and to see the day of the week you could use [code]$date="1996-01-01"; $mynewdate =date("D j F y",strtotime($date)); echo $mynewdate;[/code]
  12. OK this is not tested but try it out so far you have no results and this will at least give you and others something to work with [code]<?php if(isset($_POST[email])){ $name=$_POST['name']; $mail_to = "mattlau33@yahoo.com.sg"; $mail_subject="Online Inquery Form from Peakmore.com"; $mail_body = "Message Sent From: ".$name."\r\n<br />"; $mail_body .= wordwrap({$_POST['emailmessage']},72,"<br />\r\n");     if (mail($mail_to, $mail_subject, $mail_body, "From:$emailaddress")){         echo "Thank you.";     }     else     {         echo "Failed to send. Please try again.";     } } else { echo "You have not filled in your email address."; } ?>[/code]Also when posting code to forums select the code with your mouse and click the BB code for code or place [ code ] code in here and [ /code ] minus the spaces to present your code as I have it is much easier to read.
  13. There is always empty() as per [a href=\"http://us3.php.net/empty\" target=\"_blank\"]empty()[/a] in the PHP Manual.
  14. OK after looking at the processing php there are a couple of question in order. Are register_globals turned on on your web server in PHP? What version of PHP is the server running (in case you don't know the firest).Could you also show the actual form and method? There are logic flaws in your code that need correction for it to work properly. A quick and simple method would be to first determinne if...the user has entered an e-mail (isset() would work fine here) the user has actually pressed submit (give the submit button in the form a name and check if that [b]isset()[/b] before you do anything (prevent manipulation of the URL). So it looks like a few samall logic changes as well as a method to validate the form with php are in order in this case. So with your indulgence then show your form, also I would suggest not putting your real e-mail in the post as it is not important to me but might be to others that could abuse it. Put a bogus or use [at] instead of [b]@[/b] since a spambot or other bot will attempt to use it.
  15. In order to help you it would help me and other to see the form or ever how you are generating the data that is to be processed as well as the processing page itself. There could be a simple answer but without seeing what you currently have it would not be possible to be of much more assistence.
  16. This is commented out //$Send = $_GET['Send']; then unless you have register_globals ON then this wont work if ($Send) and it is a $_POST variable because of the method in your form so try changing if ($Send) to [code]if(isset($_POST['Send'])){[/code]and see what it does.
  17. Is it possible that one server allows 'short' tags and the one where the script does not work is not using short tags. e.g. [b]<?php verses <?[/b] If the Script starts with <? and not <?php then change it to <?php and try again.
×
×
  • 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.