play_
-
Posts
717 -
Joined
-
Last visited
-
Days Won
1
Posts posted by play_
-
-
If it does solve your issue, please mark the thread as solved
-
He's obviously registered that function name as a trademark
He's just about ready to sue every software maker that uses a function called addRow
-
Wouldn't CSS suffice by giving the div a height and overflow:scroll; ?
moving this to CSS forum as it's really client sided.
-
You are using the form name in your $_POST check.
Use the name of your button.
So instead of
if(isset($_POST['search'])) {echo "Welcome" . $_POST["fname"];} else {echo "post not set for fname ";}
do:
if(isset($_POST['submit'])) {echo "Welcome" . $_POST["fname"];} else {echo "post not set for fname ";}
--edit--
beaten by someone else.
for the second part of your script, you forgot an 'else', so you get "request method post not set" as well.
if($_SERVER['REQUEST_METHOD'] == "POST") { echo "form submitted";}ELSE{echo "request method post not set ";}
-
this will work with the way youre originally asked
in your .htaccess:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA]
-
This is now how this is typically done:
Ideally you would have one page. say, user.php
you would link to that page with a variable, like site.com/user.php?id=135 or site.com/user.php?u=wait
you would then use $_GET['id'] and query a database for that members info.
whichever way, you'll still need mod rewrite to do what you want
-
just out of curiosity, why are you doing it this way? (one script per user)
what if you have 100,000 users?
-
Number 2 is what I would like to do because the current site I am working on has only 1 form which the user fills out (no registration needed). I have 2 textareas and inputs. At the moment, when they receive errors, it takes them back to the form but with blank fields. Of course, if they entered a long bit of text into the textareas, they are going to be a little annoyed at having to re-type it and will probably not bother a second time.
I will google that phrase though and see what I can dig out.
Kind regards,
AoTB
Right. So when they submit the form and you detect errors, filled out input fields will have a value.
So if user filled out the 'name' input field, but left out the 'email' or 'password' field, $_POST['name'] will hold a value when you redirect them to the same page.
Your HTML form fields should look like this
<textarea name="message" > <?php if(isset($_POST['message'])) echo $_POST['message'];?> </textarea>
-
few things.
1. Use code tags to markup code
2. Use jQuery
3. "function addRow®{" what?
-
You just simply echo out the variables.
It depends where you store them. Database, $_POST or $_SESSION.
-
As mrMarcus said.
user_id is probably an auto increment field, so you can delete the line
`user_id` ,
if it still doesn't work, uncomment
"//echo mysql_error(); //debugging purposes, uncomment when needed".
and comeback with a decent error message.
it even says right there. "debugging purposes. uncomment when needed".
-
A bunch of syntax errors on that code
<?php $rows = range(0, 9); $cols = range(0, 9); echo "<table border='1' cellpadding='10'cellspacing='5' align='center'>"; $r = 0; while ($r < count($rows)) { $c = 0; echo "<tr> "; while ($c < count($cols)) { echo "<td>"; echo $rows[$r] * $cols[$c]; echo "</td>"; $c++; } echo "</tr>"; $r++; } echo '</table>';
-
Are you simply trying to rotate the array?
You marked your first link in SO as solved. The second link seems like a similar problem so i'm not exactly sure what the specific issue is.
Are you trying to rotate the array you get when you retrieve the 'order' column?
-
As of right now, there is none.
I have tried all joins that I could. I am not too knowledgeable with complex queries, so i came here.
One alternative is to use GROUP_CONCAT...but since it's for a pastebin site, i couldn't really risk using it since the separator could be in someone's paste where pastes.paste_id = $result['ids.paste_id'] <-- not syntax correct, but just to give the idea.
alternative 2 is to run two queries. one to get the last 10 paste_id from 'ids'., and then for each id, do a select * from
-
Not sure if what I am trying to do is possible. It's gonna be a bit hard to explain but it's actually simple.
Ok so first off, here's what an example paste(it's a pastebin site):
What I need help with is the 'recent' link, where I would like to display the last 10 or so pastes.
The complication arises with the fact the pastebin has 'tabs'.
MySQL tables are set up as such.
When you make a new paste, it's id gets created in the table 'ids' as 'paste_id'.
Each tab in the paste gets inserted into 'pastes' table, and it connects to the 'ids' table via paste_id.
So for the 'recent' page, I am trying to gather some of the latest pastes.
Right now the recent just prints an array that the query returns. If you go there right now, you'll see
Array ( [pastes] => Array ( [0] => Body of tab 1, paste 1 [1] => Body of tab 2, paste 1 [2] => Body of tab1, paste 2 [3] => Body of tab2, paste 2 ) [tabs] => Array ( [0] => Tab1 [1] => Tab2 [2] => Tab1 [3] => Tab2 ) )
Ideally, I would want MySQL to return an array(paste_id) that contains 2 inner arrays - one holding the tab names, and the other holding the body of the paste
array => [paste_id (1)] [tabs] [0] tab1 [1] tab2 [paste] [0] <?php .... ?> [1] <? php code or anything ?> [paste_id (2)] [tabs] [0] tab1 [1] tab2 [paste] [0] import twisted [1] from some.module import *
is it possible?
-
What would be the simplest way? Do you use a method in the child class?
Personally I use
parent::$this->whatever;
But I was wondering what you guys do.
-
at the very minimum connect to a database and do basic queries like SELECT * FROM table WHERE something = value.
maybe basic OOP concepts too.
-
This should be in the javascript forum.
Also, use jQuery.
-
Weird, works fine for me. I used a txt file with a number on each line from 1 to 100. These were my results:
Words: 18 , 62 Words: 58 , 92 Words: 13 , 80 Words: 65 , 95 Words: 80 , 82 Words: 4 , 61 Words: 1 , 79 Words: 3 , 43 Words: 69 , 78 Words: 13 , 82
Note that the ORDER of the results is not random in that for each pair the lower value is always first. So, if it matters if the order of the pair is random you would want to be using shuffle() anyways
Interesting. If i replace the contents of words.txt with a number on each line, i get
Words: 2 , 9
Words: 8 , 9
Words: 5 , 10
Words: 2 , 7
Words: 9 , 10
Words: 4 , 10
Words: 6 , 8
Words: 8 , 10
Words: 2 , 5
Words: 1 , 9
words.txt is just list of 5000+ words.
@Gizmola - no. i don't see the problem there. Your results seem random.
-
Although I found a way around it, I want to know, logically, why the behavior is so.
// words.txt is a text file with dictionary words on each line $lines = file('words.txt'); // The goal is to pick two random words, 10 times. for($i = 0; $i < 10; $i++) { #shuffle($lines); <--- un-commenting this is the fix i found. $words = array_rand($lines, 2); echo "Words: " . $lines[$words[0]] . ", " . $lines[$words[1]] . "<br>"; }
If i don't have shuffle() in there, I get two different set of words, not 10. ie (result from code above)
Words: massacre , spear
Words: frontiersman , kumquat
Words: massacre , spear
Words: frontiersman , kumquat
Words: massacre , spear
Words: frontiersman , kumquat
Words: massacre , spear
Words: frontiersman , kumquat
Words: massacre , spear
Words: frontiersman , kumquat
Why is this?
-
Have you used any of the MVC frameworks that are around play_ ? It seems to me that you might not understand the concepts at that stage.
No, not yet. I read that "everyone should build their own MVC framework" to understand it best. So that's where I started.
The comments on the 3rd post here (amongst others somehwere) indicate that the Model should be handling the form.
http://stackoverflow.com/questions/6015040/how-are-forms-used-in-an-mvc-framework
-
Ok but -how- would i handle the POST?
Do i make the form action go to the controller? and if so, what happens then? the IF statement will be inside a method. I need a way to call that method.
-
The query failed.
probably selecting from a wrong table or selecting wrong column.... i think.
You should look into PHP's PDO class http://php.net/manual/en/book.pdo.php
-
Creating my own little MVC framework to understand it better.
Question -
When a view outputs a page with a form in it, how is the form handled? ie, what is the action of the form?
Where does the IF statement that checks if the submit button was pressed, go? I was told inside a method in the Model...but I don't understand how a method can check if a form has been submitted or not.
Any help greatly appreciated.
Background Image To Tr
in CSS Help
Posted · Edited by play_
What does 'not showing as expected' mean? How are you expecting it to show?
http://jsfiddle.net/c3txj/60/