MmmVomit
Members-
Posts
319 -
Joined
-
Last visited
Never
Everything posted by MmmVomit
-
Now show us the code that calls that function.
-
This syntax defines a function. function func_name() When you want to actually use, or call, a function, you use this syntax. func_name();
-
I'm working on a site where people can post audition announcements. The problem I'm having is how I should categorize the auditions into usable groups. Here's my main problem. This site will be targeted specifically to singers. There is somewhat of a divide between opera singers and musical theater singers, such that an opera singer would not be interested in auditioning for Oklahoma, and a musical theater singer would not be interested in auditioning for Magic Flute. Singers I have talked to said that it would be a good idea to have separate sections of the site devoted to opera and musical theater However, there is a grey area. A company in the area does both opera and musical theater, and they hold one round of auditions for their entire season. What would be a good way of structuring my database such that it could take this into account?
-
Can you post the whole form?
-
You can think of them like an if statement. ($expr ? $true_value : $false_value) $expr is some expression that will be evaluated as either true or false. If it is true, the whole expression in parentheses will evaluate to $true_value. If $expr is false, the whole expression in parentheses will evaluate to $false_value.
-
Sorry, that should have been this. <?php ini_set('error_reporting', E_ALL); ?>
-
[SOLVED] Getting POST data from multiple select fields
MmmVomit replied to MmmVomit's topic in PHP Coding Help
Great. Thanks. -
Create an array called $sqldata. Make it a practice to only add escaped data to that array. Also make it a practice to only use $sqldata when building queries. Like so. <?php $var1 = "here's a string"; $var2 = "here's another string" // don't use mysql_escape_string. it is deprecated. // use mysql_real_escape_string instead. $sqldata['var1'] = mysql_real_escape_string($var1); $sqldata['var2'] = mysql_real_escape_string($var2); $query = "INSERT INTO table (col1,col2) VALUES ('$sqldata[var1]','$sqldata[var2]')"; ?>
-
[SOLVED] Getting POST data from multiple select fields
MmmVomit replied to MmmVomit's topic in PHP Coding Help
I don't have PHP on this computer. Would someone be willing to run the following script and see if it works? Pretty please? With a cherry on top? <html> <head> <title> Title </title> </head> <body> <form method="post" action=""> <select name="bar[]" multiple> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <input type="submit" name="submit" value="Submit" /> </form> <pre> <?php print_r($_POST); ?> </pre> </body> </html> -
Is this what you're trying to do? <?php function detect() { $counter=0; echo "</br>detect"; $result=mysql_query("SELECT * FROM result") or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "</br>counter=$counter"; echo "</br>$row[Category]"; echo "</br>Drawdate in sql=$row[DrawDate]"; echo "</br>POST drawdate=$_POST[drawnumber]"; if ($row[Category]=='Magnum'&& $row[DrawDate]==$_POST[drawnumber]) { echo "if"; // return 1; }//end if else { echo "else"; continue; // return 0; } $counter++; }//end while return $counter; }//end detect() ?>
-
[SOLVED] Getting POST data from multiple select fields
MmmVomit replied to MmmVomit's topic in PHP Coding Help
That works? Cool. I'll have to try that. -
[SOLVED] Getting POST data from multiple select fields
MmmVomit replied to MmmVomit's topic in PHP Coding Help
Yep. If I had the code handy, I'd post it. It parses the raw post data from the file 'php://input'. -
You don't need to define an onclick function. Write a function with whatever name you feel is appropriate, then call that function from the OnClick attribute of the particular input field.
-
If you have a form like this <form method="post" action="foo.php"> <select name="bar" multiple> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <input type="submit" name="submit" value="Submit" /> </form> Is there a way to properly retrieve the multiple selected items from the "bar" select box? If multiple options are selected, the $_POST variable only contains the last option selected. I've written a function myself that solves the problem, but was wondering if there is a way native to PHP, so I don't have to worry about having to put this function in every website I write.
-
Can you post some code?
-
Put this as the first line in your script and let us know what happens. <?php ini_set('error_reporting', PHP_INI_ALL); ?>
-
Newbie help :) I'm trying to make an item tracking website
MmmVomit replied to dhendler's topic in Application Design
To start with, it sounds like you need the following tables. item find user Item will have one record for each individual item you want to track. ID number, maybe a description, etc. User will have user information, so you can track who has found what. This table may not be strictly necessary. Find will log where and when the different items were found and who found them. Is that enough to get you started? -
print "<input name=\"$row[id]\" type=\"checkbox\">";
-
Selecting 2 fields from MYSQl and displaying them in PHP
MmmVomit replied to $username's topic in PHP Coding Help
<? $sql = "SELECT fname, lname FROM admin ORDER BY `ID` DESC"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<option value=\"$row[fname], $row[lname]}\">$row[fname], $row[lname]</option>"; } } } ?> -
<input type="text" name="name" value="<?=$your_variable?>">
-
Yes, this is html. You either need to set the value attribute, or add a selected attribute to the proper element of a dropdown list.
-
I wouldn't say any one function is better than another. One's a hammer, another's a screwdriver. Niether is better than the other, they're just suited to different jobs. If you tell us what you'd like to actually DO with an image, then maybe we can help you.
-
Code tags, please.