Jump to content

minidak03

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Everything posted by minidak03

  1. Double check your array using print_r() to make sure everything is set correctly.
  2. Your first error is right here "if ($v_name=="" or $v_msg=="")" look at the code below I fixed your errors and have given you with what you need. <?php define('DB_NAME', 'dbname'); define('DB_USER', 'phpchick'); define('DB_PASS', 'password'); define('DB_HOST', 'localhost'); // contact to database $connect = mysql_connect( DB_HOST, DB_USER, DB_PASS ) or die( 'Error , check your server connection.' ); mysql_select_db( DB_NAME ); //Get data in local variable $v_name = $_POST['name']; $v_email = $_POST['email']; $v_msg = $_POST['msg']; // check for null values if( $v_name == "" || $v_msg == "" ) { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://site.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> You must enter an email and password. <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } elseif( strcspn( $_REQUEST['msg'], '0123456789' ) == strlen( $_REQUEST['msg'] ) ) { echo "true"; } else { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo "Your message has been received"; } ?> I don't want to sound rude by saying this but you need to read some more PHP tutorials you've made a decent amount of amateur mistakes but if your new to PHP its ok we've all wen't through it in the past. I didn't verify your SQL statements so those may or may not be correct but the actual structure and design flow should work for you now.
  3. Basically yes, you cannot do what you did (example below) $mailto = "<? $lines = file('basedata.txt'); $l_count = count($lines); for($x = 0; $x< $l_count; $x++) { } echo "" . $lines[9] . "" ; ?>"; But you can do something like I did in my previous post.
  4. Put this on the page (or pages) where you want your footer to appear. <?php include_once('/path/footer.php'); ?> Then in your footer.php file place whatever code you want to use for your footer. Even if its a user generated page (Well depending on how you enable them to generate the pages) it's the easiest solution.
  5. That is exactly right you would get the names back from the database or other data source, put them into an array or object, create a loop for each item in the array or object and then this will enable you to generate the urls dynamically (making them unique to each user).
  6. I'm not 100% sure if I'm understanding this right but try the following. <?php $email = $HTTP_POST_VARS[email]; $lines = file('basedata.txt'); foreach($lines as $line) { $mailto = $line; $mailsubj = "Website Contact Form submission"; $mailhead = "From: $email\n"; $mailbody = "Values submitted from web site contact form:\n"; foreach( $HTTP_POST_VARS as $key => $val ) { $mailbody .= "$key : $val\n"; } if(!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } } ?> If that doesn't work can you explain a little more what is going on? What are the errors? is the email being sent but the data is displayed incorrectly?
  7. I understood it as he needs several li's with different class names and several span and inputs in each of those li's but premiso is correct if you are only using one class name as in the example he posted. Two solutions....One will work lol.
  8. You'll need to use a double loop like the example below <?php <fieldset class="tercero" style="" > <legend>Services</legend> <ol> <?php foreach($arrRestaurantsOfferings as $arrRestaurantsOffering) { echo '<li class="restaurants-offerings-%u">'; foreach($arrRestaurantsOfferings as $arrRestaurantsOffering) { printf( ' <input type="checkbox" name="frmSearch[offerings][]" value="%u" id="restaurants-offerings-%u"%s> <span for="restaurants-offerings-%u" class="checkboxes23">%s</span> ' ); } printf( ' <input type="checkbox" name="frmSearch[offerings][]" value="%u" id="restaurants-offerings-%u"%s> <span for="restaurants-offerings-%u" class="checkboxes23">%s</span> </li>' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,in_array($arrRestaurantsOffering['restaurant_offerings_id'],$arrOfferings)?' checked="checked"':'' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['name'] ); } ?> <?php } ?></ol></fieldset> ?> Please note that example probably won't work, it was just to show you a method that you can use to loop through all of the records and display your li tags and then display the span and input tags between each. Depending on the exact output your looking for you may need to put in some if statements to stop the inner loop at a certain point so that the outter loop may continue.
  9. P.S. there are a couple other minor syntax errors in the script but I just noticed the following which is hard to see upon first look, just below that line I fixed for you you'll find this mysql_guery Notice anything about that spelling? It should be mysql_query That is what is most likely your major cause of your problems.
  10. If all your data is stored in the database what you'll need to do is use JavaScript and AJAX to dynamically generate that data. Have a look at the example below. <script type="text/javascript"> function fire_ajax( dropDownFired ) { // What you need to do here is make an AJAX call to a php (or other) script to get // back the required data and once you have that data show the second drop down // box and so on ect... } </script> <!-- Drop Down 1 --> <select name="dd1" onchange="fire_ajax('1')"> <option value="1">1</option> </select> <select name="dd2" onchange="fire_ajax('2')" style="display:none;"> <option value="1">1</option> </select> Sorry thats not a 100% answer but there is a bit of work required (maybe 30 mins or so) to write up everything and test it, ect... Basically what you'll want to do in your Javascript is make an AJAX call to get back the data, then use Javascript to change the css display of the second drop down to "Block" and then use Javascript to dynamically fill in the values of that drop down list. This is done much easier when using a Javascript library like jQuery.
  11. Its hard to really drill down without seeing your source code but I can give you a little something to go by if you can handle doing the queries and a little bit of HTML/PHP yourself. Basically if I understand you correctly your issue isn't so much turning there names into links but understanding more or less how to retrieve there data correctly when that link is clicked. If this is correct here is a general workflow you can use to achieve your goal. 1) When you dynamically generate the tables with player names, ect... also pull back the unique id stored in the database (this is usually called 'id' but it can be anything), this is also usually the primary key and it's usually set to auto-increment (making it unique to each user). 2) When your displaying this information into the html table, create the link around there name (see example below) <a href="">This is there name</a> Now the location of the link will point to the page where you want to display the users data so something like this <a href="http://blabla.com/show_user_data.php">This is there name</a> Now the last step is to add a query to the end of that url and this query will store the unique database id of this user so something like this <a href="http://blabla.com/show_user_data.php?user_id=543">This is there name</a> Then dynamically insert the unique database id where the number 543 is, from there when the user clicks on the link you can access that user_id paramater using the PHP $_GET or $_REQUEST variables. So from here if a user clicks a link they are brought to the show_user_data.php page and on this page you would have something like the below code <?php $user_id = $_GET['user_id']; // now after this use the value in $user_id var to get this users data from the database $query = "SELECT * FROM table WHERE id = '$user_id'; // and now perform your query and any other php work to display that information ?> I hope this helps you out a bit.
  12. Well very quickly on line 39 you have the following code which is missing an end bracket $newsupdate = strip_tags($_POST['update']; The above is what you have and the below is what you should have $newsupdate = strip_tags($_POST['update']); Now that would not cause it to only show a white page and there is nothing in that code which could cause a fatal error, what I'm thinking is that something in your config.php file is causing a fatal error and somewhere you probably have turned off show all errors. Look for something like this below in your code error_reporting(0); and change it to error_reporting(E_ALL); This will then display an error on your page as well as all warnings. You may also have this featured turned off in your php.ini file, double check that file for the code below. error_reporting = off You can also try to turn your error reporting on by using the below code ini_set("display_errors", 1); This way if you have error reporting on and you still see a white blank page, we can rule out any hidden PHP errors and where they are coming from, if it does still display a blank page, try loading it up in a different browser and see what happens. However if it does display an error after you turn reporting on then post the error here or look at the file (and the line in that file) which is causing the fatal error. I hope that helps you out a bit.
  13. <!-- put this at the top of the page --> <?php $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; ?> <!-- put other code and html in here --> <!-- put this code at the bottom of the page --> <?php $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); echo 'This page was created in ' .$totaltime. ' seconds.'; ?> Remember PHP executes on the server so you'll never actually see a timer counting if you want to see an actual timer you'll need to use JavaScript. The code provided counts up and not down if you want something that counts down just use a while loop $timer = 500; while($timer > 0) { // do something here $timer--; } There are a variety of different ways you can do this depending on how you actually need it to perform.
  14. I quickly tested out your script and it does send the email just fine which means I would double check your hosting account to make sure they allow the use of the PHP mail() function, I do know that some providers disable it (Reasons of which are unknown). As for the PHP data collection, that also seems to be working fine, I got all of the post fields without changing anything. As for the meta redirect I would try using the full url so http://mydomain.com/thankyou.html instead of just thankyou.html @DrTrans - Yes true the header function should be used over the HTML redirect but only use the header function if you are not sending out any data to the screen. Eg of working header ----- header('Location: http://blabla.com'); some HTML ------ Eg of non working header ------- some HTML header('Location: http://blabla.com'); ------ Hope that helps a little bit.
  15. The check_url function just takes the URL and makes sure its safe to use, and the check_plain function is just used to encode special characters, so it changes the & symbol to & The if($logo) part is just there to determine if the script has a URL to a particular logo. If your trying to display logo 1 for the first language and logo 2 for a second language try the following <div id="logo-floater"> <?php if($language->name == "Dutch") { $logo = 'location_of_dutch_logo'; } elseif($language->name == "English") { $logo = 'location_of_english_logo'; } ?> <h1> <a href="<?php print check_url($front_page); ?>"> <?php if ($logo): ?> <img src="<?php print check_url($logo); ?>" title="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" alt="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" id="logo" /> <?php endif; ?> In this code you have to know the value of the $language->name variable but you can also change out the $language->name == "English" part with $language->language == 'en' which would be might be more stable and easier to use
  16. Something just like this usually works for me just fine (Thats when the \n or \r\n method does not work) <?php $to = "email@yoursite.com"; $headers = "From: whoever@what.com"; $subject = "anything"; $message = "Line one This is now on the third line This is on the fourth line this is on the sixth line"; mail($to,$subject,$message,$headers); ?> But your right it may have something to do if your setting html headers
  17. Depending on your server sometimes \n and \r\n doesn't work, for some reason on my GoDaddy servers both the \n and \r\n won't work when I'm sending out my emails, try the following method if \n and \r\n doesn't work for you. (This method is not the best way to do it but it does work) $body = "....You have received these contact details from form...: "; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s ",$b,$_REQUEST[$a]); } I just placed in a hard return (hit enter to create a new line) which works for certain providers.
  18. This might not work sorry I didn't test this but I think i see an issue with your SQL statement. $image = "SELECT '$type' FROM pages WHERE project_id='$project' LIMIT 1"; Should be $image = "SELECT $type FROM pages WHERE project_id='$project' LIMIT 1"; No need for the single quotes around $type after SELECT because it will be searching for the wrong name unless your name also incldues the single quotes around it.
  19. This is the best way store the image path in the database and then just store the image in a folder somewhere.
  20. I would do this another way like so $string = 'Test image <a href="http://domain.com"><img src="http://domain.com/images/test.jpg" alt="test"></a> is a test.'; $clean = strip_tags($string); echo $clean; I know your trying to hack it out with Regex or learning but sometimes its easier not to do it with Regex.
  21. Well my username was created for a number of reasons, the first reason is because I used to own a small Mazda B2200 truck which I lowered to the ground then I sold it for a new 2003 Dodge Dakota (New Back then) and I planned to lower the dodge just like I pimped out and lowered the mazda. So my name came from that mini for low truck and dak which stands for dakota and 03 because its a 2003. So minidak03 really stands for mini dakota 2003.
  22. if($row_hour_count['hour_count'] > $row_rankd['hours']) { $rank1 = $row_rankd['title']; } do( elseif($row_hour_count['hour_count'] > $row_rank['hours']) { $rank1 = $row_rank['title']; } } while ($row_rank = mysql_fetch_assoc($rank)); Look at where your do statement is it should be inside of your else if or completely outside of your if statement that is what is causing your error.
  23. The best structure is the one you can remember unless you want added security, for instance I usually always place my images in a folder called images which makes sense right however if you don't place an index file in this folder as well on some servers someone can type in mypage.com/images/ and see a full indexable list of all your sites images. They can also hot-link to them but there are php tactics which you can use to get around that. For videos its not suggested you place them in a videos folder this folder should be much more complex like 55sdaf65as and a sub-folder in that folder called anything like 54sad564sad5f. The reason I do this with videos is because when people want to hot-link to a video it really does a number on your bandwidth however if you have a flash player to play these videos you can code flash so that its pretty much impossible for the visitor to guess your document structure. For secured and protected files you can always place them in a folder called secure or protected but the true security comes into place in your actual code to restrict access to these files. Your document structure can be whatever makes sense to you but you also really need to think about security in your code to restrict access to your document structure.
  24. lol nevermind I must have mis-read your post its because your encoding is us-ASCII this can usually be changed in the program you are using under file settings. Not exactly sure which program your using though but the meta tag won't change that information. if your using non-ASCII characters like Japanese then you would be using different file settings.
  25. If your data in the text file is seperate on each line you can do this $lines = file('textfile.txt'); echo '<select>'; foreach($lines as $line) { echo '<option>'.$line.'</option>'; } echo '</select>';
×
×
  • 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.