-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
OOOH i see the problem (I think) When you do window location, if you dont add an absolute URL (IE http://www.website.com) then it just appends the current URL with what you are going to. try instead of what you have, putting the absolute url, and see if there is a problem. I may be completely wrong though. As I said, my knowledge of javascript is not somewhat lacking (this is the PHP forums ya know!) hope that helps!
-
hmm that looks like it SHOULD work... instead of what you have try function go_there() { var where_to= confirm("Do you really want to bid?"); if (where_to)//since this already has a bool value in it there is no reason to check whether or not the value is true { window.location="?auction=view&confirm=yes"; } else { window.location="?auctions=view"; } }
-
ah i think i see the problem <tr><td><input type = "submit" name = "submit" value = "delete"></td></tr> </form> <?php if($_POST['submit'] == 'submit') the value of the submit button (named submit) is delete, and you are testing to see if its value is submit change the above to <tr><td><input type = "submit" name = "submit" value = "submit"></td></tr> </form> <?php if($_POST['submit'] == 'submit') and it should work hope that helped EDIT: Dam too late haha.
-
change this <tr><td><input type = "checkbox" name = "deletebox" value="<?php echo $row['member_ID']; ?>"></td> to this <tr><td><input type = "checkbox" name = "deletebox[]" value="<?php echo $row['member_ID']; ?>"></td> and it should work (I think, someone correct me if im wrong ). Hope that helps!
-
oh, yeah I misunderstood what you were trying to do. window.location = 'http://www.yoursite.com/index.php?confirmed=yes' should work just fine to be honest. Can you post the javascript you are using with your confirmation box. by the way, dont EVER call javascript java or vice versa. Javascript, and Java are two completely different programming languages, and calling them the same thing can get you yelled at lol.
-
Or not ^^ lol it loses the variables it gets when clicking bid when java changes the page i hate javascript ha Isnt there any way to do a confirmation box in just php oO no you're right. do this with javascript: window.location = 'http://www.yoursite.com/index.php?confirmed=yes' and on the index.php get the confirmed from this: $_GET['confirmed'] Or do that lol
-
well, Im not versed to well in Javascript (I know a good amount of it, but your specific problem would take a little bit of research on my part to answer) can you do a confirmation type box in PHP? of course, but it won't really be as dynamic as in javascript (like you wont be able to make a pop-up box really). you could just make a form with two submit buttons, one called yes, and one called no, as so <input type=\"submit\" name=\"yes\" value=\"BID\" >"; <input type=\"submit\" name=olue=\"BID\">"; and on your php page do something like if (isset($_POST['yes'])){ //blah blah } else if ($_isset($_POST['no'])){ //blah blah } else { echo "YOU AINT CLICK NUTHIN" exit(); } is that what you were looking for? I hope that helps
-
javascript and PHP can not talk to each other in that way. Since one is parsed server side and the other client side, the only places these two can talk is through post and get variables ( I think, someone correct me if I am wrong) Also, you cant change variables in a PHP page once it has been loaded without reloading the page. What you want to do can be done with PHP fairly easily if you submit the form, but using Javascript and PHP in the way you want is impossible I'm afraid (as far as I know. again I could be wrong)
-
If you really want to do this well, I strongly suggest you read a php/mysql tutorial, and use php.net ALOT. a good tutorial site can be reached at http://www.tizag.com/phpT/ Now for your questions, First lets start off on your database structure. You are going to want to be able to have users click and go to a certain page (say manga.php) and based on a get variable (the ?var=something part . var is the get variable, and something is the value) the page loads up dynamic content. So you are going to want to make the get variable something unique for each row in your database table, (for example, an id column) So for your database, you are probably going to want a row that has a unique identifier, IE id, which is different for each entry. You are also going to want the manga name (IE inuyasha, bleach, naruto, etc. etc.) After that, it depends on your application. You may want to have the URL where all the images are in that specific row. You may also want a column that has number of views, etc. All the extra cool stuff can be added later though once you have a basic working app. FYI, you are going to want to put all your manga information into this one table, that you can call mangas (well for now. you can add more tables later once you are more comfortable with how tables, mysql and php interact) Now as for how it works. Again you are going to want to read php tutorials so you know exactly why it works, but I'll give you an example. say a user clicks a link called manga.php?id=14. manga.php could look something like this $id = $_GET['id'];//this gets the value of the get variable you passed. in this case its the get variable id, with a value of 14 $query = mysql_query("SELECT * FROM manga WHERE id='$id'");//this queries the database. //it selects everything from the table manga where the column id is equal to the value of the $id variable //in our case its 14. Remember, the id column should be a unique identifier column where each entry is different! $num = mysql_num_rows($query);//this gets the number of rows returned from the query. it should only be 1 if ($num < 1){ echo "Sorry your query returned no results"; exit(); }//this checks if there was any result. if not then say "nothing was returned' and exit the script $row = mysql_fetch_assoc($query);//this gets an array with all the information from the query. It would have all the information //for each specific column, and the keys of the arrays are the specific column names in the table. //say we wanted to output the name of the manga that the user is trying to access, and the name //is stored under the column 'name' then we would do the following $name = $row['name']; echo "You are accessing the Mana $name!"; This isn't all you would need to do tho. You still have to connect to the database, and create the table, among a few other fairly simple steps, but I'm not gonna write you a whole tutorial to do that =P So yeah, Just look up some php/mysql tutorials (all you need is a basic understanding really to do what you want) and you can have a basic application that does what you want it to do in no time. good luck! I hope this helped!
-
Posting to the URL is always 1 selection behind
mikesta707 replied to coupe-r's topic in PHP Coding Help
well... since you search works, I don't really see the problem. If you don't want users to see the 1 behind problem, you can use post instead of get -
Listing all files/directories via a page
mikesta707 replied to stickynote427's topic in PHP Coding Help
did you just copy and paste that code, or alter it some how? post your code, because the code from that function should work theoretically -
you dont really need to return $total, since you are assigning it a value (I'm pretty sure, someone please correct me if i'm wrong) but I dont know if using that return would mess up the script. however, you probably want to encase all your php in the following if statement if (isset($_GET['num1'] && isset($_GET['num2'] && isset($_GET['num3']){ ...your code } that way you dont run that switch statement if the user first accesses the page.
-
Update. Can anyone review my discussion board/other related user functions (IE samples). The Edit page for profile is unfinished yet, so clicking the edit profile link does not work. your login credentials are phpfreaks password
-
www.website.com/index/ www.website.com/login/ those are pointing to directories (index and login directory respectively) on your webserver, instead of the pages themselves. As far your problem.. make sure your supporting files (IE images, include pages, etc.) are in the same directory, or whatever directories they are supposed to be in. I hope that helps... i really have no clue what you are trying to accomplish. please provide more details on your problem
-
making Javascript (not java) and PHP talk to each other is somewhat difficult to understand. Since PHP is parsed on the server side, and javascript on the client side, the only way for these two languages to really talk to each other (based on my understanding. I could be wrong) is through post/get variables. One thing you could do is make a hidden form, and set the value to some php value, and then use javascripts HTML DOM functions to get that value, IE <!-- javascript element=document.getElementById('hiddenfield').value; mark1 = new GMarker(new GLatLng(openInfoWindowHtml(element), -75.240867), { icon: blueIcon}); and then you would just make the hidden form as such <input type="hidden" value="<?php echo "myvalue"; ?>" /> I might have my syntax a little off, but the basic Idea is there. Hope that helps
-
links print dynamic content into same page?
mikesta707 replied to rogueblade's topic in PHP Coding Help
Not entirely difficult, but it will take a bit of coding. Again, you can use the Limit command in SQL, but instead of using one number, use two. IE for the first fifty, you do something like mysql_query("YOUR QUERY... LIMIT 50"); for the second page do something like mysql_query("YOUR QUERY... LIMIT 51, 100"); I'm pretty sure thats the proper syntax, but You may want to double check on that. You will also probably want to have some variables that change depending on the current page, so you dont have to write 50 different pages all with the same query slightly changed. As in $start = 0 $end = 50; if (isset($page)){ $start = end+1; $end *= page; } $query = mysql_query("YOUR QUERY limit $start, $end"); again you may want to check my syntax. You are going to definitely want to change the above code around the fit to your needs of course, but something similar to that would probably do it. Although you may want to check with someone more versed in doing queries like that tho, because my experience with them is limited. Hope that helped! -
try if(isset($_POST['submitted'])) { $problem=FALSE; else if(empty($_POST['fname'])) { print "<span style='color:red;font-weight:bold;'>Please fill out your first name field</span><p/>"; $problem=TRUE; } else if(empty($_POST['lname'])) { print "<span style='color:red;font-weight:bold;'>Please fill out your last name field</span><p/>"; $problem=TRUE; } else if(empty($_POST['email'])) { print "<span style='color:red;font-weight:bold;'>Please fill out your email adres</span><p/>"; $problem=TRUE; } else if(empty($_POST['ctn'])) { print "<span style='color:red;font-weight:bold;'>Please fill out your contact number</span><p/>"; $problem=TRUE; } else { print"please try again"; } } ?> [code=php:0] the last else you wrote is only connected to the last if, and not the entire chain of if statements. I'm still not sure what you are trying to do with this form, or what the problem is. Can you explain further?
-
links print dynamic content into same page?
mikesta707 replied to rogueblade's topic in PHP Coding Help
two things you could do. First, in your actual SQL query, you could use the limit command like so: $sql = mysql_query("your query stuff... LIMIT 5"); that would limit the returned results to 5 rows. OR you could use the break command. Something like [/code] <?php $i = 0; while($row = mysql_fetch_array($listInfo)) { if ($i == 5){ break; } print "<li>".$row['data_title']." ".$row['data_date']."</li>"; $i++; } ?> [/code] the break command just tells the code to leave the loop at that point. Hope that helps! -
change if ($myrow = mysql_fetch_array($result)) to while ($myrow = mysql_fetch_array($result)) using an if statement will only provide 1 result because the if statement is only executed once, where the while statement is executed until the condition is false (in this case the condition would become false when there are no more entries from your mysql result) hope that helps!
-
<a href="http://www.maine.info/events/<? echo $display_cat; ?>/january.php">Jan</a> That should work for what you need to do. Hope that helps
-
links print dynamic content into same page?
mikesta707 replied to rogueblade's topic in PHP Coding Help
your if statements are not running because you dont set any value to your get variables. you just initiate them, but their values are still null. try something like [/code] <?php print "index.php?Link1=value"; ?> [/code] for each of your links (except for link2 its Link2=value, links 3 is Link3=value etc.) Hope that helps! -
[PHP+Mysql] Help with webpage not displaying
mikesta707 replied to Warraven's topic in PHP Coding Help
sounds to me like your test file isn't in the same folder as all the supporting files (IE the pictures, any external files like a style sheet, a php include, js include, etc.) I would make sure that the in the page's directory, all the image sources actually lead to he images. themselves -
well, it seems to me like you need to pretty much learn PHP as a whole. I can give you the answer to the specific problem you are asking for, but you won't really understand how to adapt the solution to fit multiple problems. If I were you, instead of trying to start off learning PHP by making a Mafia game type of PHP application, I would visit a few tutorial sites, make some simple applications, and then start on that project. As you learn more and more PHP, you are going to realize that making the kind of think you want to make isn't so simple =/ I would recommend tizag for a starting php tutorial http://tizag.com/phpT/ and there is php.net, which as you will learn, is your friend http://www.php.net another good site is w3schools http://www.w3schools.com/PHP/DEfaULT.asP and here of course =) also, google is your friend too good luck! hope this info helped!
-
Ahh ok, I see what you were saying. Yes, indeed you are absolutely right. however, in my specific case, What I am grouping together are sort of "achievements". basically a user does a specific thing on my application, and they are rewarded this achievement. In my table I am probably going to have different columns for different types of achievements, types describing what part of the application the achievement comes from. I thought about making a seperate column for each achievement, and having a user id column for each row, but adding new achievements, and taking away old ones would become a pain. Regardless, thank you for typing that out! I never really thought of that, and that is very good advice.