-
Posts
760 -
Joined
-
Last visited
Posts posted by joel24
-
-
if you want both have type = "$type1" or type="$type2"
-
<?php //rest of code here
There you go. Enjoy. Good luck!
hahha gold!
-
-
your button would be like
<button onclick="onSubmit()">Submit Form</button>
or
<input type="submit" onclick="onSubmit()" value="Submit Form" />
then put that js up in the head
-
use the mail function... its instant, other way is messy and more power intensive using database/cron jobs.
-
change
if(isset($_REQUEST['submit']))
to
if(isset($_POST['item']))
then the code will only execute if any checkboxes are checked.
also change the $_REQUEST's to $_POST....
-
$query = mysql_query ("SELECT * FROM tablename where id=1 limit 1,1");
limit x, y
... first result is 0, so its saying start at the second result (x) and then get (y) rows
-
$full_name="Mike Jerry Hanson";
$fullname = explode(" ", $fullname);
which splits $fullname into an array, split up by the spaces.
so
$fullname[0] is now "Mike"
$fullname[1] is now "Jerry"
$fullname[2] is now "Hanson"
-
that would work for calling it...
but to store the form data in the session
you'd have to have that form post to whatever page.. or itself
and then have
session_start();
$_SESSION['test'] = $_POST['test'];
etc etc
-
And yes, you can set it manually. $_POST is an array afterall. Nothing really special about that. But people really need to learn to use better practices. When coding use error_reporting(E_ALL);. There is a PHP notice for using undefined constants as keys.
interesting!
just had a play around you can even set $_SERVER['PHP_SELF'] etc etc..
always assumed they'd be locked...
-
get
"build your own database driven website using PHP & MySQL" by kevin yank.
I started with it, was a great book to start with.
Then after that I started jumping into projects and messing around
-
I can not set it manually because I get it from previous page where names of inputs are set automatically.
... so you have a form on the previous page and its being posted to the page with the script you posted?
what are you trying to achieve by your foreach loops??
if you just want to look at the contents of the $_POST array you can use print_r($_POST);
have you tried this code? it *should* work
if (isset($_POST)) { foreach($_POST as $key){ if (is_array($_POST[$key])) { foreach ($key as $key2 => $value){ echo "<br />Key=".$key2."value=".$value; } } }
-
i don't think you can set an $_POST value manually??
i.e.
$_POST[firstkey][secondkey]=12; won't work?
what if $_POST array isn't multidimensional?
i'd do
if (isset($_POST)) { foreach($_POST as $key){ if (is_array($_POST[$key])) { foreach ($key as $key2 => $value){ echo "<br />Key=".$key2."value=".$value; } } }
oh, and what code is on line 5?
is it isset($_POST)?
and the second foreach should be
foreach $key as $key2 etc etc
i think you're problem was you were trying to use an array as an index.. i.e. $_POST[$key] when $key was an array.
use that
foreach $key as $key2 and you should be fine
-
user the mail function
http://au2.php.net/manual/en/function.mail.php
.. put something like this in your code after the file has been uploaded
$message = "A file has been uploaded!";
mail('yourEmail@yourDomain.com', 'File Uploaded', $message);
-
you'd have a form that posts the memo?
so
$memo = mysql_real_escape_string($_POST['memo']);
$sql = @mysql_query("UPDATE tablename SET
memo = '$memo'
WHERE groupNumber = $groupNumber
AND memberNumber = $memberNumber");
-
your form doesn't have an action...?
i.e. it should be something like (if the data should be posted to itself)
<form method="post" enctype="multipart/form-data" action="<?php echo basename($_SERVER['PHP_SELF']); ?>">
otherwise set action="rarqara.php" to whatever page the data should b posted to.
and theres no submit button?!
-
as far as I know you're meant to define the selected option in the option tag...
i.e.
<select name="clnt_state" id="clnt_state" tabindex="8" class="form-inputitem"> <option value="" selected></option> <option value="AL">AL</option> </select>
how is each individual state <option> getting written?
manually or from an array...?
i'd suggest putting the states into an array,
then doing a foreach loop to list them all i.e.
foreach ($states as $s) {
if ($row_rstocdetail['clnt_state'] == $s) {
$isSelected = "selected";
} else {
$isSelected = "";
}
echo '<option '.$isSelected.' value="'.$s.'">'.$s.'</option>
}
-
print out all the posted variables...
i.e.
put in
print_r($_POST);
exit();
on the top of your feedback.php form
also you should probably swap
<input type="button" with <input type="submit"
-
what error do you get?
i'm assuming your date format will be incorrect...
the default mysql date format is YYYY-MM-DD
-
you can use javascript to call a PHP page which checks if theres any new shouts every say 10minutes? or just wait and have it done on every page refresh...
i'd probably just have the script check if there were any messages in the tbl_message / whatever this converts to table which were had the users ID as the toid and had not been viewed yet (viewed = 0)
if there were, i'd display the messages and at the same time set a "viewed" column in the tbl_message table to "1"
-
i always used
$total = (mark / totalPossible) * 100;
-
most common way is to send the page number in the url... with $_GET...
then have your sql which gets the comments and also looks for the page number...
then based off that page number and the amount of posts you want to display, you'd have the SQL changed depending on this..
i.e. if page was 3 and you displayed 20 posts per page,
$page = ($_GET['pageNumber'] - 1) * 20;
minus one because you want to find the start of the posts needed..?
then your sql would be like
"SELECT * FROM comments ORDER BY whatever LIMIT $page, 20"
with limit x, y.. the x variable sets the starting number (remember the first entry in the results list is zero, so 20 is the 21st result...... so if you have limit 5, 10.. you'd get the 6th - 10th results.
then you'd need a sql command which also counted how many comments there were for the page numbers..
then i'd divide it by 20 or however many posts per page to work out how many pages you need.
$amountOfComments = $amountOfComments / 20;
for ( $counter = 1; $counter <= $amountOfComments; $counter += 1) {
echo '<a href="'.basename($_SERVER['PHP_SELF']).'?pageNumber='.$counter.'">'.$counter.'</a>';
}
and then the y value tells sql how many results to pull.
anyway thats just the basics, theres heaps of tutorials on it that will explain it better than I can, google is your friend
-
go buy the book
"build your own database driven website using PHP & MySQL" by kevin yank.
great book to learn php/mysql
-
1000 requests?
you'd get 200 requests every 5 minutes, you could set it to ten.
and these requests would only happen if 200 users were logged in, in which case each page they view would most likely require SQL queries anyway. so if only 30 users are logged in, you'll have 30 requests every 5 minutes
I need a script ! Urgently !!!
in PHP Coding Help
Posted
you forgot the ;