Jump to content

algidDes702

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by algidDes702

  1. I am failing to see the problem? Is it still there, if so explain it some more. If its not please mark your post as 'solved'
  2. with other form input tags, the value attribute would usually place the content within that field. With the textbox however, this is not the case. You would place your content inside the tags like this: //yours echo "<tr><td></td><td><textarea rows=\"10\" cols=\"50\" name=\"homepage\" value=\'$homepag\'></textarea></td></tr><br>\n"; //mine echo "<tr><td></td><td><textarea rows=\"10\" cols=\"50\" name=\"homepage\">$homepag</textarea></td></tr><br>\n"; the content to be edited will get placed inside the text box. The content that is showing up before the text area is due to your echo"$homepage<br><br>\n"; remove that and i would think everything should work fine. As far as your method of getting the data, there are other ways to access and get data from a database but an understanding of object oriented programming (OOP) would be needed as PHP's library has objects and classes set up to do just that. Here is an example: http://php.net/manual/en/book.pdo.php If OOP is hard to understand or you havent worked with it before then i would say stick with your current method. algid
  3. my apologies for the improper syntax there. The correct way to use textarea is as a tag, such as: <input type="text" name="textName"/> <!--This is the single line entry --> <textarea name="textareaName" rows="10" cols="10"><!-- Your variable that pulls in your 3 paragraphs would go here--> </textarea> both of those above can be used within the form tags and will pull in the data using $_GET or $_POST variables. Here is a link to the documentation for textarea: http://www.w3schools.com/tags/tag_textarea.asp and for input type text: http://www.w3schools.com/tags/att_input_type.asp I work with a lot of mixed HTML and PHP, but started off with HTML and CSS. CSS is waayy more reliable than working with table attributes and i really try to stay away from using tables, i stick with using DIV tags instead. of course depending on the use case. Heres a quick tutorial on CSS as well in case you are interested: http://www.w3schools.com/css/ hope this helps out! algid
  4. Looks fine to me as well in chrome and firefox, however i have had major rendering frustrations in my past using tables and their standard attributes. I usually stick with CSS and have a little bit more control over exactly how 'bottom-aligned' i guess you could say, i wanted my images, divs, whatever.
  5. I would agree with mrMarcus, there is not much difference between placing it directly outside your loop and it being in the loop, the placing in html would be the same.
  6. Okay i somewhat understand what you are asking. If im not mistaken, you have a ticker symbol and you want to use that to get the current price of the symbol. The link you provided is a .csv file. PHP has a function called fgetcsv() which you can use to parse the information. The returned value is an array, usually parsed by field. <?php $conn = mysql_connect("xxx","xxx","xxx"); $db = mysql_select_db("xxx",$conn); $getPrice = file('http://quote.yahoo.com/d/quotes.csv?s=AAPL&f=l1&e=.csv'); //opens the file and gets the contents and puts it in an array // the $getPrice array now contains your price, you will place it where ever you need by using $getPrice[0] $sql="INSERT INTO portfolio (symbol) VALUES ('$_POST[symbol]')"; if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($conn); ?> hope this helped your question algid
  7. Hey there, for future reference, be sure to place your code inside of [ code ][ /code ] (with no spaces on the inside of the tags) tags so its easy to read. As for your example, why dont you change the the input type to 'textarea' instead of just 'text' ? You can then use either CSS to style in the appropriate height and width or you can use a format like this: <textarea rows="2" cols="20"> to get the proper height and width you need. Hope that helped algid
  8. good luck its a super small issue, step away from your code and come back. You're going to slam your head against your desk when you discover the issue here haha
  9. Before you try submitting them into the database just echo or print them out to the page so you can make sure the data is getting assigned to those variables. That error message tells me that the data that is submitted isnt reaching your query. So after the if statement just do something like this: echo $name."<br/>".$email."<br/>".$question; Make sure the data is getting printed. You can also check the URL since you are using GET. thanks algidDes
  10. Youre form was submitted using the GET method. So to get your variables that are submitted you would do something like this: if(isset($_GET['submit'])){ $name = $_GET['name']; $email = $_GET['email']; $question = $_GET['question']; //your code to insert variables into db can go here or after the if statement } hope this helped
  11. Something like this? html code: <div class="headerCont"> <div class="columns column1"> column 1 </div> <div class="columns column2"> column 2 </div> <div class="columns column3"> column 3 </div> <div class="clear"></div> </div> css code: <style type="text/css"> .headerCont { width:1000px; height:250px; text-align:center; margin-left:auto; margin-right:auto; } .columns { height:250px; float:left; } .column1 { width:60%; background-color:#6FC; } .column2 { width:20%; background-color:#CC0; } .column3 { width:20%; background-color:#0F0; } .clear { clear:both; } </style> To get this to happen you have to use float and clear. When you float a div or element it looses its strict height and width that pushed surrounding elements into position, however if you clear the floats as in my .clear class then the elements gain their strict height and widths back. thanks algidDes523
  12. maybe something like this?? $keywords = array("web design","oldham web design","php new"); $textToSearch = "This the string you want to search that might include web design, oldham web design, or php new"; foreach ($keywords as $search){ $pattern = "/$search/"; $matches = preg_match_all($pattern, $textToSearch); $numberOfMatches = count($matches); echo $numberOfMatches.PHP_EOL; } i believe that should work for what you asked, buuttt i havent exactly had my coffee this morning so dont hold your breath! That should be a start though. thanks algidDes523
  13. Does your database have a 'date' or 'timestamp' column to query along with your other fields? eg: $sql = 'SELECT * FROM user_references WHERE employment_id=\''.$rowe['id'].'\' AND user_id=\''.$user_id.'\' AND status=\'active\'' ORDER BY date ; it was difficult for me to follow your quotes and concatenations. Here is a good guide to follow if this didnt help, but it will order your query results by however you like using the existing fields in your database. http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html thanks algidDes523
  14. When you have an empty action in a form, ie: <form method="post" action=""> it is a self serving form so the url would not change unless you made the method "GET" instead of post. "GET" puts the variables into your URL. However if you are using these forms for MySQL queries, putting the queries in the URL leaves the application open for SQL injections which can be malicious. Use echo, print, or print_r is using arrays to make sure the data being entered is what you want to be used in the database query. for example i might do this for your code: if (isset($_POST['type1'])) { echo "This was type1:" . $_POST['type1']; echo "UPDATE table SET status = 1 WHERE id = $rid"; //this will print just the database query to make sure $rid is what you want it to be //mysql_query("UPDATE tabke SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } if (isset($_POST['type2'])) { echo "This was type1:" . $_POST['type2']; echo "UPDATE table SET status = 1 WHERE id = $rid"; //this will print just the database query to make sure $rid is what you want it to be //mysql_query("UPDATE table SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } if (isset($_POST['type3'])) { echo "This was type1:" . $_POST['type3']; echo "UPDATE table SET status = 1 WHERE id = $rid"; //this will print just the database query to make sure $rid is what you want it to be //mysql_query("UPDATE table SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } ?> your code that we have is slightly uncomplete to know exactly what you are doing, we dont know where $rid is coming from. Also you said the URL doesnt change but how your forms are set up, your URL shouldnt change UNLESS your function call within the onclick "this.form.submit()" is suppose to alter the URL when hitting submit on any of the three forms. algidDes523
  15. Small change for above, minor detail. Just so you know Miss_Jones, PHP variables are case sensitive and as Drummin stated, php scripts run and process from top to bottom not bottom to top. <?php $var = "Some text here!"; if (isset($_POST['Clickme'])){ //here the original post had a lowercase "c", below the value of the button was "Clickme" not "clickme". I changed this line to match form $var = "Some NEW text here!"; } ?> <html> <body> <form> <h5>Firstname:</h5> <input type="text"> <input type="submit" name="Clickme" Value="Click me!"><p><?php echo $var; ?></p> </form> </body> </html> Hope the responses here helped your question
  16. With what you just put, you are asking to print a mix of your array's keys and its values. What ever list you want to print into your should either be keys or it should be values of an array. Mixing them is not good or make printing them difficult. What do the "A" and "B" need to be in your selection element? Does the 'true' value need to be passed on once the form is submitted and A or B is selected? if you are trying to print this list: 01, 125, 150, A, B into your selection then your array should just look similar to this: <?php $list1 = array("01","125","150","A","B"); echo "<select name='firstSelector'>".PHP_EOL; foreach ($list1 as $key=>$value) { echo '<option value="'.$key."'>'.$value.'</option>'.PHP_EOL; } echo "</select>".PHP_EOL; But really if you need specific values passed with each option when the form is submitted then you can make it an associative array where the array keys get printed into the options value like so: <?php $list1 = array("prijzen0"=>"01","prijzen1"=>"125","prijzen2"=>"150","prijzenTrue1"=>"A","prijzenTrue2"=>"B"); echo "<select name='firstSelector'>".PHP_EOL; foreach ($list1 as $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'.PHP_EOL; } echo "</select>".PHP_EOL; ?> The above would print this: <select name='firstSelector'> <option value="prijzen0">01</option> <option value="prijzen1">125</option> <option value="prijzen2">150</option> <option value="prijzenTrue1">A</option> <option value="prijzenTrue2">B</option> </select> let me know if that helps or not thanks for sharing
  17. Kicken is right there. If there is some other reason that won't work for your situation you can use strpos to find a very exact string. If its not found a false will be returned. However, if the search finds that exact string and there is more to the left or right it will still return the position of that match. I found this quickly and I'm sure there are functions that are purely Boolean and return a true or false instead of false or a position, search php.net. Thanks, AlgidDes
  18. Hey guys! Was unsure where the best place to put this, however here is a pretty neat tool to use to test and build RegEx patterns. Check it out! http://gskinner.com/RegExr/ Opinions are always welcome! thanks algidDes702
  19. Hi team, I am new to this forum, only have 9 posts. I was unsure where to post this but this looks like the optimal place to request this. It might really need to go to the SWF team if so let me know. I would like to see (if it's not already implemented and I don't see it) is these posts and forums tied more closely to social media. I mean I think a forum is not just about random people answering questions, that's why there are certain forum titles; such as Guru, Freak, Insane. These titles play a big part in the value of their post or reply. I believe a simple tie to their Facebook or twitter pages/names could for one bring more PHP inspired users to the forum, bring more valuable knowledge to the forum (not saying what's here is not enough but more the merrier), will increase the knowledge across the general public of what and how php works, and it can grow a deep, more personal relationship between "gurus" and novice users which can in the end can help grow and expand the PHP community. It's a simple request that might be placed in the wrong area, however I would like to see how people and other users feel about this. Thanks for your time and looking forward to your feedback AlgidDes702
  20. A quick explanation of that example might help as well as reading the documentation: $my_cart = isset($_SESSION['my_cart'])?$_SESSION['my_cart']:0; So basically its starting off with a conditional statement: is $_SESSION['my_cart'] have a value in it or not? the other side of the ? is the value that will be applied depending on if the statement is true or false. If TRUE then it uses the value to the left of the ":" and assigns that to $my_cart. If FALSE then it assigns the value to the right of the ":" which would be 0 which is also equal to FALSE. so statement is true $my_cart = $_SESSION['my_cart']; statement is false $my_cart = 0; Hope for this specific example that helped explain it if the documentation didnt quite make sense, sometimes it confuses my so a little more help is always good
  21. I agree with litebearer all the way. 99.98% of the time its not the best idea to store an actual image inside your database. Databases are using for sorting, storing, and organizing data and information. Filesystems are better used to store and organize actual files. I would upload/move the file from its original location to a specific location on your server/localhost. Store the path to where you are moving the image in the database along with the file name. Also agree with litebearer on its not good to use the same variable like you did, litebearer's method was the direction to go. I also saw in your PHP code that you used $_REQUEST to get an ID of something. $_REQUEST can cause problems and can also be a security hole as the $_REQUEST array can store values from $_POST, $_GET, and $_COOKIE variables. So if later down the road you accidentally or do use $_POST['id'] AND $_GET['id'] the value that $_REQUEST stores is the last post or get to store its value. In your html form you set the method to POST so stick with getting data using the $_POST variable. For more specifics on this you can google it and some good sources for information will come up. Hope this helped!
  22. without fully understanding the context of the data you are trying to process and what a 'series' is. What i got from your question is that you need anything/number that is 52 to be processed, anything else to be left out. The first reply was a great way to do so unless in the future you had an even number such as 56 in your array that you didnt want to process/add when you only wanted the 52 'series'. <?php $seriesNum = 52; //could be whatever number you want to add, can also be retrieved from a data source somewhere else rather than hardcoded $array = array(52,53,52,56,65,234,45,52); //array with odd and even numbers foreach( $array as $key => $value ) { if( $value != $seriesNum ) { //set the test to your series number, a modulus operator would return even numbers that aren't 52 series in your ex. unset($array[$key]); } } $array = array_values($array); //this line re-indexes the returned array starting from 0 array (optional, not needed for your question) print_r( $array ); ?> Hope this helped along with the other's replies! Thanks!
  23. If you hit submit twice, it shows up. You arent filling that area with any value or string until you hit submit the first time. So it shows up empty the first time but leave &message= blank because it was empty before the first submit. On the second submit, there is a value to place into the &message= and it shows up. So you need to fill the area on the first submit. Would doing something like this work for you? $vars = "uname=".$username."&pword=".$password."&message="$email."".$message."&email=".$email."&from=".$from."&selectednums=".$number."&info=1&test=1"; Let me know if that works for you! (Im new-ish to PHP so doing my best) let me know glad to help if i did actually help haha algidDes702
  24. i would have to agree with Pycho on this. there are many different ways to manage the data and process it how you are asking that depend on how its being retrieved/entered and used.
×
×
  • 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.