Jump to content

arcanepsyche

Member
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Location
    Seattle, WA

Contact Methods

  • Website
    http://www.CornerstoneWebSolutions.com

arcanepsyche's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks Stefan! Repeating = better learning!
  2. Thanks for the response. The reason I can't use that is because there is a different response for different numbers of pages so I have to add conditions. I ended up using this, which worked fine: if ($page_count >0 && $page_count <5) { $price_per_page=25; } if ($page_count >4 && $page_count <10) { $price_per_page=20; } if ($page_count >10) { $price_per_page=15; } And then later multiplied the $price_per_page by $page_count to create $total_page_price which will give my customers the price they will pay based on how many pages they want built. Thanks for your help guys!
  3. Ah! That's better. I knew there had to be something like that out there. Thanks much!
  4. Yeah, that's a bit more simplified, thanks. I have 25 of them, so I'll have to decide which format I like better.... Good to know about the ; not being necessary. Thanks!
  5. I started out using the if/else statements but then found info on switch and it just seemed like a simpler way of doing the same thing...unless I'm not able to figure out how to do the above. Either way, thanks for experimenting for me. Don't let it eat into your champagne drinking time tonight!
  6. Hello all. I'm attempting to use the switch function for the first time and have a general question about the following code, which is part of a .php page I'm using to display the results of a submitted form: switch ($_POST['page_count']) {case "1": echo "There is 1 page."; break; case "2": echo "There are 2 pages."; break; case "3": echo "There are 3 pages."; break; }; Is there a way to make the code cleaner by using some sort of "through" statement? I tried this: {case "1-5": echo "There are between 1 and 5 pages"; But that didn't work, which is what I thought would happen. Or, is there some sort of greater than or less than symbol? My users are able to choose any number between 1 and 25 on the form and I'm not too keen on copying and pasting 25 different cases on the PHP page if there's a simpler way out there somewhere. Thanks in advance for the help, and Happy New Year! Zac
  7. Thanks guys, this was helpful! On to actually trying to build something.....
  8. Hello again all, and Merry Christmas! Hopefully you can help me with this small question I have about one of the PHP/MySQL video tutorials on the site. In the tutorial, Stefan uses this code to grab DB info and display it using PHP: $query = "SELECT * FROM people"; $results = mysql_query($query); $my_rows; WHILE($row = mysql_fetch_array($results, MYSQL_ASSOC)) { $my_rows=$my_rows . "Name: ($row['name']} " . "id : ($row[id]} "; } I'm not quite understanding the syntax behind the $my_rows variable. Why do we need to place it above the WHILE loop and then define+add on to it inside the WHILE loop? Thanks in advance, Zac
  9. Alright, problem solved! It was the $_post vs $_POST. I tried your array before changing anything and the array caught the information but the $print function didn't. And then I changed the code to $_POST and everything displayed correctly. I heard that the capitalization doesn't matter, is that maybe not true? Thanks Monkeysaurus for your help! Zac
  10. Thanks for the help, it's good to know I don't need that code. However, I'm still getting the same result. Here is the code after deleting the portion you told me to: <?php $name_first=$_post['name_first']; $name_last=$_post['name_last']; $email=$_post['email_address']; $comments=$_post['comment']; print "The first name is: {$name_first} "; print "The last name is: {$name_last} "; print "The email address is: {$email} "; print "And the comments are: {$comments} "; ?> I'm still not getting any of the form information to display. I'm not sure if this matters, but I've created my form in Serif's Webplus10 and then set the form element names in that program. Then, I set it to use a remote scripts from my hard drive and it uploads both the page and my scripts to my existing hosting account. Would Webplus somehow be the problem? Here is a link to a page I just created with a test form set to submit to my .php page. Not sure if that's helpful either though: www.cornerstonewebsolutions.com/page10.html I've checked the names of the form elements over and over to make sure they match, so I know it doesn't have to do with that. Thanks again, Zac
  11. Hello, I am very new to PHP and have been watching Stefan's videos in an attempt to learn. I'm doing well, except that I'm stuck on getting collecting information to display on the .php page that is processing the form results. When I submit the form, everything loads fine in terms of text and html code, but the variables I have set up using the $_post information are just being skipped. I'm certain the php is collecting the form info because I used $_get and the information showed up in the URL bar, it just didn't display on the page. Here is the code: (changed back to $_post) <?php $_post['name_first']; $_post['name_last']; $_post['email_address']; $_post['comment']; $name_first=$_post['name_first']; $name_last=$_post['name_last']; $email=$_post['email_address']; $comments=$_post['comment']; print "The first name is: {$name_first} "; print "The last name is: {$name_last} "; print "The email address is: {$email} "; print "And the comments are: {$comments} "; ?> Any help for a beginner is appreciated!
×
×
  • Create New...