![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
phpretard
-
Posts
821 -
Joined
-
Last visited
Never
Posts posted by phpretard
-
-
/[(^0-9)]/ thank you for the reply but it didn't work (probably my fault)
$string="12345678";
Here is all of it:
elseif(strlen($string) < { $alert="<script>alert('Your Password must contain At Least 8 Characters')</script>"; } elseif(!ereg('[^A-Za-z]', $string])) { $alert="<script>alert('Your Password must contain At Least 1 Letter')</script>"; } elseif(!ereg('/[(^0-9)]/', $string)) { $alert="<script>alert('Your Password must contain At Least 1 Number')</script>"; }
I am sure there is one string for all of this but I cant figure it...
-
I am trying to check a string for numbers
This is what I have:
$string="password1"; if(!ereg('[^0-9]', $string)) { $alert="<script>alert('Your Password must contain At Least 1 Number')</script>"; }
It doesn't work...any thoughts?
Ultimately the password must contain 8 charactors 1 number and 1 letter
-
Why does this get stuck?
$level = 1; while ($level <= 10) { // if I "echo $level" it counts to 10??? $maleQ.$level=mysql_query("select gender, level from athletes where gender='$level' and level='$level' "); $male.$level=mysql_num_rows($maleQ.$level); $level++; }
-
Why don't you just use a single query with BETWEEN and if you need the number of rows for the values 1-10 you can just use COUNT and GROUP BY level or gender.
That sounds like it will work...I didn't think of it thank you.
I haven't used that type of query before though.
I understand BETWEEN, COUNT, and GROUP but puting them together hurts my brain
Do you have an example I can look at?
-
I am trying to set up a loop that goes up to 10 and changes the query so instead of
$male1mQ=mysql_query("select gender, level from athletes where gender='1' and level='1' "); $male1=mysql_num_rows($male1Q); $male2mQ=mysql_query("select gender, level from athletes where gender='2' and level='2' "); $male2=mysql_num_rows($male2Q);
over and over up to 10 ... I am trying to put this in a loop and I'm stuck.
Thank you
-
Thanks a bagillion!!!!
-
I don't know if this will work but I got it from: http://us2.php.net/function.strpos
<?php $website = "http://www.zshare.net/download/664558148eb3f5z1/"; $findme = "Downloading"; $pos = strpos($website, $findme); if ($pos === false) { echo "Expired link<br >"; } else { echo "Good link<br >"; } ?>
-
That worked!!
But now I get a duplicate for the first one.
Array ( [user] => 1138227 [athletes] => Array ( [0] => Array ( [0] => 4 // <-- row id [1] => 2 [2] => 5 ) [1] => Array ( [0] => 4 // <-- row id [1] => 1 [2] => 3 ) [2] => Array ( [0] => 5 // <-- row id [1] => 1 [2] => 3 ) ) )
any thoughts?
-
The idea behind this code is to set multiple arrays as sessions.
Each array should contain 3 variables about the athlete.
I can only get one row to come back and I think it should have a ++ somewhere, I just don't know where???
while($athlete=mysql_fetch_assoc($athletearray)) { $id[]=$athlete['id']; $level=$athlete['level']; $gender=$athlete['gender']; foreach($id as $var){ $_SESSION['athletes'] = array($id, $gender , $level); } // end for each }free($athletearray); //THIS IS WHAT I GET BUT I KNOW THERE SHOULD BE 2 SEPERATE ARRAYS Array ( [user] => 1138227 [athletes] => Array ( [0] => 5 //<-- row id [1] => 1 [2] => 3 ) ) ) //I NEED SOMETHING LIKE THIS Array ( [user] => 1138227 [athletes] => Array ( [0] => 5 // <-- row id [1] => 1 [2] => 3 ) ( [0] => 4 // <-- row id [1] => 2 [2] => 5 ) )
Thank you!
-
Thank you. Very helpfull!!!!
-
Can someone tell me how to display the all the years between date('Y') - 21 in a select box?
I can add them but can't figure how to subtract them...
It is for a birth year
<select class="athlete_input" name="dobY"> <option><? echo $_POST['dobY']; ?></option> <? $stop = (int)date('Y') -21; for($y = date('Y'); $y < $stop; $y++){ echo '<option value="'.$y.'">'.$y.'</option>'; } ?> </select>
Thank you!
-
$go=$engraving_id; header("Location: shop_cart_add.php?prod={$go}");
-
<? if (isset($_POST['submit'])){ $sum=$_POST['addend1'] + $_POST['addend1']; } ?> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Math</title> </head> <body> <form action="" method="post"> <table border="0" width="100%"> <tr> <td width="72">Addend</td> <td><input type="text" name="addend1" value="<? echo $_POST['addend1']; ?>" size="6" /></td> </tr> <tr> <td>Addend</td> <td><input type="text" name="addend2" value="<? echo $_POST['addend1']; ?>" size="6" /></td> </tr> <tr> <td>Sum</td> <td><input type="text" name="sum" value="<? echo $sum; ?>" size="6" /> <input type="submit" name="submit" value="Answer" /> </td> </tr> </table> </form> </body> </html>
-
I guess you should make the form first
-
I do need to pass both...
should the array go into the funtion?
function validate_empty($post, $pop) { if (empty($_POST[''])) { $alert = "<script>alert('$var')</script>"; $pass = "NO"; } return array('alert'=>$alert,'pass'=>$pass); }
-
Are you in control of the server?
What kind of box?
ie.. Windows IIS, etc
-
What kind of math?
adding?
subtracting?
multpying?
division?
-
Thank for the explination,,,
It works great.
Do you mind if I complicate it a little?
<?php
// FUNTION PAGE.PHP function validate_empty($post, $pop) { if (empty($_POST[''])) { $alert = "<script>alert('$var')</script>"; $pass = "NO"; } return $alert; return $pass; } ?> // HTML PAGE.PHP <? include ("the page with the functions"); if (isset($_POST['submit'])) { $result = validate_empty("question", "Empty") } ?> // HTML HERE <? echo $result; ?>
What do you think about this?
You have no idea how much time this script would save me!
-
This works for me:
$leadid=$_SESSION['leadid']; header ("location: buy.php?leadid={$leadid}");
-
function validate($var){ $alert = "<script>alert('$var')</script>"; return $alert; } // this doesn't work either
I always research before posting.
-
// when the form submits $update_the_same_row=mysql_unbuffered_query("update books set ISBN='".$_POST['ISBN']."', Title='".$_POST['Title']."', Pages='".$_POST['Pages']." where row_id='".$_POST['row_id']."' ") or die(mysql_error()); // goes in your form <input type="hidden" name="row_id" value="<? echo $row_id; ?>" />
Is this what you mean? It's difficult to understand without the code...
-
I an trying to validate a form .
if (empty($_POST['question'])){ // here is what I usually use $alert = "<script>alert('This Work Fine')</script>"; } I would like the above in a function so I tried this: ------------------------------------------------------------ <?php function validate($var){ $alert = "<script>alert('$var')</script>"; } if (empty($_POST['question'])){ validate('The question is Empty'); } echo $alert; --> The function script is on a different page and included() when the form is submitted.
Is their something obvious that I am missing?
It doesn't work as a function
-
Oops...the problem was elsewhere.
My bad.
-
I hope the code below explains my problem.
$textarea="Here is all the information ® in the text area"; $replace = str_replace("®", "<sup>®</sup>", $textarea); // I can't quite figure how to use this $new_text="Here is all the information<sup>®</sup> in the text area";
Any help?
[SOLVED] Help with code
in PHP Coding Help
Posted
I need to convert numbers to text.
The instructions are to "call the convertNumber function"
I would like to be able to post to this, so I thought convertNumber($_POST['theNumber']);
I can't seem to get it to work. Can anyone read this and help out?
Thank you