
dink87522
Members-
Posts
142 -
Joined
-
Last visited
Never
Everything posted by dink87522
-
I removed the strip tags etc although no go still. Okay, is there another tutorial/example of thsi somewhere (the PHP official site is often hard to understand I think) as I just can't get it working. Or is there another method I could do this?
-
?
-
Learn Python. Seriously.
-
Okay, I don't get it. My form now looks like <input type='submit' name='Pay[60]' id='Pay[60]' value='Pay' /> <input type='submit' name='Pay[60]' id='Pay[89]' value='Pay' /> <input type='submit' name='Pay[60]' id='Pay[95]' value='Pay' /> etc My processing form part look like: $ID = strip_tags($_POST['Pay']); $ID = mysql_real_escape_string($ID); $ID is coming through as an array although I can't get/find the array contents (using print_r only gives "Array"). I even tries $ID[0] and $ID[1' etc although had no luck. What am I doing wrong???
-
I still don't really get it I don't think. I don't know what the id numbers will be though.
-
Okay, so I have a page with a heap of fields and buttons on it (and want to keep it like that really) inside one form. Layout Box 1 Button 1 Box 2 Button 2 Box 3 Button 3 Box 4 Button 4 etc... Box 1 is called 'amount1$id' Box 2 is called 'amount.$id' where $id is the $id of the data being displayed etc So a sample form may look like Box: "amount22" Button: "Pay22" Box: "amount25" Button: "Pay25" Box: "amount32" Button: "Pay32" Box: "amount39" Button: "Pay39" Box: "amount420" Button: "Pay420" Its working fine up to that point. My problem now is that I can't work out how to get that id number from the form once submitted. If I could get the button name somehow I could do it, although I don't know the button or box names when writing the processing script. I could use a loop and check if button1 to buttonX was posted etc, although if there is a large number of entries in the database, then that starts to become a problem. Thoughts?
-
How to use $_POST with the post name being a variable?
dink87522 replied to dink87522's topic in PHP Coding Help
Thanks, that works and will do what I need. -
How to use $_POST with the post name being a variable?
dink87522 replied to dink87522's topic in PHP Coding Help
print_r: [payAmount22] => -3885 That is printed right above my code above, nothing else is changing it after that. -
$amountBoxName = "amount".$id; // Constructs the name of the input field $amountToPay = strip_tags($_POST["$amountBoxName"]); $amountBoxName then goes to 'amount22' says, however $amountToPay is then showing also as 'amount22', not getting the value of the text field whose name/id is amount22 on the previous page. How do I do this? I tried having " around the $amountBoxName, ' and no quotes although still can't get it working.
-
I do what you have got there and just echo the variable as part of the message to be sent and it works for me. Are you sure $code is not empty?
-
I don't get it, I am echoing the variable before overwriting it again though aren't I?
-
$a = $landSellCheck[0]; echo("<p>a: $a"); $a = $landSellCheck[1]; echo("<p>a: $a"); $a = $landSellCheck[2]; echo("<p>a: $a"); $i = 0; $landSellCheck = $landSellCheck[$i]; echo("<p>b: (0): $landSellCheck"); $i = 1; $landSellCheck = $landSellCheck[$i]; echo("<p>b: (1): $landSellCheck"); $i = 2; $landSellCheck = $landSellCheck[$i]; echo("<p>b: (2): $landSellCheck"); As can be seen from the output below when I echo my array by manually inserting the index number, it works fine as it should. If I set the index number as a variable and echo it, it works for index value 0, for index value 1 is gives 'a' somehow (no idea where that comes from) and for index value 2 it is empty. What am I doing wrong? Output is: a: landSellConfirm7 a: landSellConfirm6 a: landSellConfirm1 b: (0): landSellConfirm7 b: (1): a b: (2):
-
Okay, I actually had read that page before lol although after reading it again do not still understand it I don't think. Tizag tutorials are normally excellent although I found other websites more clearer in this case. I got it owrking using $query = "SELECT * FROM playerFinanceTransactions, playerFinanceCategories, Users WHERE playerFinanceTransactions.categoryID = playerFinanceCategories.categoryID AND playerFinanceTransactions.userID = Users.userID AND Users.userID = '8' AND playerFinanceTransactions.categoryID = '3'"; Thanks for your help!
-
Can anyone see the problem with the query?
-
$query = "SELECT * FROM Transactions, Transactions, Users WHERE Transactions.userID = '6' AND transDate = '2010-12-09'"; $result = mysql_query($query) or die("Error: <br>" . mysql_error()); $count = mysql_num_rows($result); echo ("Count: $count <p>"); if ($count >= 1){ echo "<table class='with-border highlight' cellpadding='5'>"; echo "<tr class='row-1'> <th>Heading</th> <th>Amount ($)</th> </tr>"; while(($row = mysql_fetch_array($result))){ // Keeps getting the next row until there are no more to get // Print out the contents of each row into a table echo "<tr class='row-2'><td>"; echo $row['heading_description']; echo "</td><td>"; echo $row['amount']; echo "</td></tr>"; } } echo("</table><p>"); Thanks for that, I've tried to use it above and are running into problems. The table setup is as you described above. I've got some test data in the tables. Using the above query I always gets 3x the correct number of rows I should be getting, what is wrong with my query (I want to display in a table the heading(s) with the corresponding amount)?
-
My other thought is to have a table for each day (maximum time a day needs to be stored for would be 6 months, so 180 tables) and then in each table have the primary key as the users name, then the financial data stored against that. Do you think this would be better? The data will be used to generate individual user reports only (i.e. so a user can look back at their financial history).
-
Okay, not sure what exactly I need but I need to store data in a MySQL database. The financial data for each user has to be stored for each day. I.e. User 1 has 20 financial data columns say (rent, maintenance, wages, shopping... etc). I need to store each of those separately so they can be displayed in a report. There is more than one user. Most likely a couple of hundred users although it needs to work for up to a few thousand users. Also, each user's daily financial data has to be stored against the date of that data so the user can see the change in finances between day X and day Y for example. So far my best idea has been to create a table for each user and then in that table store the financial data in the columns against the date as the primary key. Does anyone have a better way for this or should I do this?
-
I have a form a user may submit which has a text area. If the user enters "Today is the first day of the week" it will be stored in the database like that (note the carriage returns etc). If I then get that data from the table and echo it, it will print as 'Today is the first day of the week'. How can I print it so that it will retain the user's input formatting/the formatting shown stored in the table?
-
Maybe post the code you do have so far?
-
Wait, I see what you mean. Even a couple of sentences in the body are different. How can that be though, I only have one index.php (no index.htm or anything else either) in there???
-
? There is only one idnex.php. The source is different as the php includes aren't working there for some reason.
-
Sorry if this is a stupid question http://www.dinksoftware.com/fig/index.php looks as it should with the php includes working. However if you go to http://www.dinksoftware.com/fig or http://www.dinksoftware.com/fig/ the php includes don't work for some reason. index.php <?php session_start(); ?> <?php include('header.php'); ?> <?php include('topMenu.php'); ?> <?php include('sidenav.php'); ?> <div id="content"> <h3>Introducing 'The Business Sim'!</h3> <?php $errorMessage1 = $_SESSION['errorMessage1']; echo("$errorMessage1 <p>"); $_SESSION['errorMessage1'] = ""; ?> The Business Sim is an online, free to play educational game currently under development. <strong>The first round of gameplay will commence in Q1, 2011. </strong><br /> <p>Have gameplay ideas/suggestions or any other comments? Want to help mould the game? </p> <br/> <?php include('footer.php'); ?> </div> </body> </html> header.php part (no other includes or anything in this) <a href="index.php"><img src="header.png" alt="The Business Sim" width="550" height="100" border="0"/></a> How do I fix this? I want http://www.dinksoftware.com/fig and http://www.dinksoftware.com/fig/ to work like it does when you go/fig/index.php etc.
-
No, md5 is defiantly way more secure. I would not want to be a user of your site where you stored passwords in plain text.
-
Don't a lot of sites use AJAX to do that?