![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
DBookatay
-
Posts
334 -
Joined
-
Last visited
Posts posted by DBookatay
-
-
Show us more code that goes along with
<td>.formatText("nmF","First:").</td>
Also, what are the errors?
The only other code is the input:
<input type="text" name="nmF" value="">
-
I have a script, (which I did not create) that makes form fields required… [code]<? function formatText($inputName,$text) { if ($_SERVER['REQUEST_METHOD']=="POST") { if(empty($_POST[$inputName])) { echo '<span class="redBold">'.$text.'</span>'; $_SESSION['ispassed']=false; } else {echo $text;} } else echo $text; } ?>
and then:
<td><? formatText("nmF","First:"); ?></td>
This way works fine, but what I am now trying to do is to put it into a php page that is already echoing an output.
Basically:
<td>’.formatText("nmF","First:").’</td>
Problem is, all the text gets echoed at the top of the page, not where I want it, in the <td>.
I’ve tried to change all the “echos” and tried <td>’.$formatText("nmF","First:").’</td>
but it throws errors…
Any ideas?[/code]
-
Then I would use this strategy:
1. Write a function to generate a random 4 or 5 digit number.
This is what I am trying to get help with...
-
Because on the add form that I use as admin, I dont choose the username, I want to have it automatically created.
Since both myself and my fience will be adding names to our list.
-
As I mentioned in previous posts, I am working on a site for my upcoming wedding, where family members can login and RSVP, choose their dinner meal selections, send reception song requests, and so on.
I have a working login page (http://www.cindyandbrad.com/index.php?category=002&sub=101), where information (username & password) gets pulled from the table 'authuser', and if all matches takes them to a secure page, (http://www.cindyandbrad.com/passed.php).
I have a separate page where an admin (me) adds guests, and certain values into the table.
Problem is... I want the usernames to be the guests last names, and since its a lot of family on the list there are going to be multiple members with the same username. So I want to add a 4 or 5 digit random number to the name, as long as the number is only used once. So the last name "Smith" will become username "Smith0654"
Heres my code now:
// Add New Guest to List if (isset($_POST['per1_sir'])) { $per1_nmF = ucfirst($_POST['per1_nmF']); $per1_nmM = ucfirst($_POST['per1_nmM']); $per1_nmL = ucfirst($_POST['per1_nmL']); $per2_nmF = ucfirst($_POST['per2_nmF']); $per2_nmM = ucfirst($_POST['per2_nmM']); $per2_nmL = ucfirst($_POST['per2_nmL']); $uname = ucfirst($_POST['per1_nmL']).RANDOM_NUMBER_GOES_HERE; mysql_query("INSERT INTO authuser ( per1_sir, per1_nmF, per1_nmM, per1_nmL, per2_sir, per2_nmF, per2_nmM, per2_nmL, app, salad, status, level) VALUES ('$per1_sir', '$per1_nmF', '$per1_nmM', '$per1_nmL', '$per2_sir', '$per2_nmF', '$per2_nmM', '$per2_nmL', '2', '2', 'active', '2')")or die(mysql_error()); echo "<meta http-equiv=\"Refresh\" content=\"0; url=add.php?body=Added\">";}
Does anyone have any ideas as to how this is done...
-
<?php $doomsday = '1213315200'; //unix timestamp for June 13th 2008 $countdown = $doomsday - time(); $countdowndays = round($countdown/60/60/24, 1); echo "you will be married, and considered dead inside in $countdowndays days"; ?>
As far as the invitations and stamps - yes it fiscally makes more sense to do it via an online site. However, as you will most inevitably come to realize - when planning a wedding - its best to leave the those types of decisions up to the woman. As my wife explained to me, she has been planning this wedding for her whole life.
Love both the comments... Sarcasm is always the best way to wallow in self misery...
Thanks for the help...
-
Does anyone have a script that will countdown to a certain day?
I'm getting married on June 13th, 2008 and am in the process of creating a site for my
fiancé's and my family, to view our status, reception information, ceremony location, etc... and want a "### days remaining" script on the page.
-------------------------------------------------------
Also random poll: My fiancé thinks that it's cheesy to create a dB that everyone can go to to rsvp and make their meal selection, instead she want to have everyone mail in reply cards. If I
elegantly do a site, with a simply login area for friends and family to rsvp, is that cheesy? It would
definitely be more cost effective (less stamps / reply cards) and less time consuming (simply print a list of
attendees and meal selection for the banquet hall.)
Anyone have an opinion?
-
and can you tell me why u use this phillipina as your dir name is that your country?
Thats what my hosting company (DreamHost.com) uses...
-
$where[] = "vin LIME '%".$_POST['vin']."'";
Do you mean "LIKE" or is "LIME" correct?
-
I use this code:
function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } $URL = (selfURL());
-
Can someone spot an error:
if(strlen($_POST['vin']) == 6) {$where[] = "vin LIME '%$_POST['vin']'";} else {$where[] = "vin = '$_POST['vin']'";}
I get the following Parse Error: "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/.phillipina/dbookatay/login.carcityofdanbury.com/passed/New/list.php on line 242" and I cant figure out why...
-
Got it...
$query = "SELECT SUM(amtPaid) as thesum from IH_Records where type = 'Payment' and id = '{$_GET['id']}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $total_pymtsAmt = $row[thesum];
-
SELECT SUM(row) AS thesum FROM `table` WHERE `this`='that'
I think you mean this:
$query = "SELECT SUM(row) AS thesum FROM IH_Records WHERE type = 'Payment' and id = '{$_GET['id']}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $total_pymtsAmt = $row[thesum];
but it doesnt work...
-
I use this code:
//Count Payments $query = "SELECT count(*) as thecount from IH_Records where type = 'Payment' and id = '{$_GET['id']}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $total_pymts = $row[thecount]; //Count Late Fees $query = "SELECT count(*) as thecount from IH_Records where type = 'Fee' and feeType = 'Late Fee' and id = '{$_GET['id']}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $total_latefees = $row[thecount]; //Count Repos $query = "SELECT count(*) as thecount from IH_Records where type = 'Fee' and feeType = 'Repo Fee' and id = '{$_GET['id']}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $total_repos = $row[thecount];
to count the number of Payments / Late Fees / Repos in my table IH_Records.
Now how do I add the values?
Meaning if there are 3 "$total_latefees" for 4.50, 3.00, 7.00, how do I get a total of 14.50?
-
<?php if (empty($_POST['balance'])) { $balance = $_POST['totalPymts']; } else { $balance = $_POST['balance']; } ?>
Thank you, I totally forgot about the "if (empty" idea...
-
What is the correct way to write the code I am trying to do?
if ($_POST['balance'] IS NULL) {$balance = $_POST['totalPymts'];} else {$balance = $_POST['balance']";}
I'm stumped...
-
take ' ' out and the last comma problem solved
$soldamt = $_POST['soldAmt']; $soldAmt = number_format($soldamt,2,'.');
Now nothing gets outputted
-
made some adjustments
<?php $soldAmt = number_format($soldamt,2,'.',' ');?>
should out put $100.00
Almost there... It is doing what I need, but its adding a space:
I typed 1200, and it outputed 1 200.00
-
It's still adding comma's
-
I tried your code, but it puts commas into the post, which will pose a problem.
Is there another way to do it?
$soldAmt = number_format($_POST['soldAmt'], '.');
Anyone?
-
$totalamount=number_format($totalamount, '.');
I tried your code, but it puts commas into the post, which will pose a problem.
Is there another way to do it?
$soldAmt = number_format($_POST['soldAmt'], '.');
-
Does anyone have a working example?
I've read http://us.php.net/number_format, but it doesn't explain how to do what I want to accomplish.
-
yep - you will need a cron job.
Do you know of anywhere that shows code examples, or working demos?
I want to have a similar function, if a user is on a mailing list...
-
Solved it myself...
(Don't know if this is the correct way, but it works.)
setlocale(LC_MONETARY, 'en_US'); if ($row['balance']) {$balance = money_format('%(#10n', $row['balance']);} else {$balance = '';} if ($row['down']) {$down = money_format('%(#10n', $row['down']);} else {$down = '';}
[SOLVED] Minor tweek needed on a current script...
in PHP Coding Help
Posted
This is the entire code...
If you want to see it in action, go here: http://www.carcityofdanbury.com/apply.php?applicant=single
I am now trying to change that page, so I need to change the code as well....[/code]