Jump to content

jiveturkey420

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

About jiveturkey420

  • Birthday 04/28/1983

Profile Information

  • Gender
    Male
  • Location
    Mid Western Florida

jiveturkey420's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm having a problem with a shopping cart project I'm doing for school. <font size="6"><b>Add a New Product</b></font><hr/> <form method="POST" action="products.php"> <b>Name:</b> <input type="text" name="prod_name" size="25" value="" /> <b>Price:</b> <input type="text" name="prod_price" size="25" value="" /><br/> <b>Description:</b> <input type="text" name="prod_desc" size="53" value="" /><br/> <b>Weight</b> <i>(in lbs):</i> <input type="text" name="prod_weight" size="4" value="" /> <b>Amount in Stock:</b> <input type="text" name="prod_stock" size="5" value="" /><br/> <input type="submit" name ="action" value="Add"><hr></form> <?php if ($_POST['prod_name'] >= '5') { echo "Product name is greater than or equal to 5<br/>"; } if (is_float($_POST['prod_price'])) { echo "Product price is a float<br/>"; } if (strlen($_POST['prod_weight']) < 4) { echo "Product weight is under 1,000lbs<br/>"; } echo $_POST['prod_price']."<br/>"; if(is_float($_POST['prod_name'])) { echo "Superglobal POST prod_name is a float"; } ?> Everything works, except for the is_float() function. It wont echo out "Product price is a float". Am I using it properly?
  2. Righteous. It's working now. Thanks y'all.
  3. Hey y'all, I can't seem to figure out how to put snippits of PHP in a post with the fomatting. You know, like gedit or some other program does, with the different colors for different kinds of code or whatnot? Could anyone help me out with how to do this?
  4. Don't put the <?php ?> tags in there. You can remove them, and the echo. You'd want it to look like this I believe.... <?php if (isset($image)) { echo "<img src=\"images/gallery-photos/$image\" border=0>"; } elseif (!isset($image)) { } echo "<img src=\"images/contact-01.png\" border=0>"; ?>
  5. I was creating a news section to a website, and ran into a problem. I am using a MySQL database to store the news entrys, and this particular table only has 2 columns. I created the table like so.... CREATE TABLE news (time timestamp NOT NULL default now(), news varchar(10000)); The news is inserted into the table using like so...... INSERT INTO news VALUES (' ', '$newnews'); ...through a php script. The value of the first column of my table always winds up being 0000-00-00 00:00:00 Why isn't it recording the proper time? I am using a LAMP stack on Fedora 17
  6. So you're saying that I have to remove the semicolon before "date.timezone" and add a " = UTC" at the end? I found this bit that you posted in php.ini, and it's actually the same as mine. Only there was a semicolon before date.timezone, and no = UTC
  7. Yeah Mahngiel, that was it, thank you. I don't see where in php.ini timezones can be modified.
  8. Alright, I got that. I run "chown jon /etc/php.ini" , and then open it in gedit. When I go to save it, it says that's it's unable to make a backup, and it won't save.
  9. Hey! I'm new to PHP so bear with me please. =) I'm running a LAMP server on my Fedora 17 system. I am looking to modify my PHP.ini file to change the error reporting and possible the timezone settings. I opened a terminal and ran "whereis php.ini" and the output was this...... php: /bin/php /usr/bin/php /etc/php.ini /etc/php.d /lib/php /usr/lib/php /usr/share/php /usr/share/man/man1/php.1.gz Which on is the php.ini file I have to edit? How will I set up the error reporting so it'll help me debug. Thanks for any help guys!
  10. I looked for php.ini by running "whereis php.ini" in my terminal, but it gave me 7 or 8 different locations. Here is the output. [jon@localhost ~]$ whereis php.ini php: /bin/php /usr/bin/php /etc/php.ini /etc/php.d /lib/php /usr/lib/php /usr/share/php /usr/share/man/man1/php.1.gz I am running Fedora 17
  11. I am relatively new to PHP. I create a simple calendar script, but I've discovered an error. It was 10:52pm EST(UTC -5) on Thursday, Jul 17 2012 realtime, but my program was saying it was Jul 18 2012. I figure it's something with the date() that I'm not doing right, but I'm not sure. Perhaps someone can help me out? I'll post the script below.... <?php /* Calendar Begin */ $current_day_name = date(l); $current_day_short_name = date(D); $current_day_num = date(d); $current_day_suffix = date(S); $current_month_name = date(F); $current_month_num = date(n); $current_year = date(Y); $current_month_total_days = cal_days_in_month(CAL_GREGORIAN,$current_month_num,$current_year); $current_month_first_day = mktime(0,0,0,$current_month_num,1,$current_year); $current_month_first_day_name = date('D',$current_month_first_day); $days_in_week = 1; $days_in_month = 1; switch ($current_month_first_day_name) { case "Sun": $empty_cell = 0; break; case "Mon": $empty_cell = 1; break; case "Tue": $empty_cell = 2; break; case "Wed": $empty_cell = 3; break; case "Thu": $empty_cell = 4; break; case "Fri": $empty_cell = 5; break; case "Sat": $empty_cell = 6; break; } echo "<font size='5'><i>".$current_month_name." - ".$current_year."</i></font>"; echo "<table border='1'>"; echo "<tr> <th width='70' height='30'>Sun</th> <th width='70'>Mon</th> <th width='70'>Tue</th> <th width='70'>Wed</th> <th width='70'>Thu</th> <th width='70'>Fri</th> <th width='70'>Sat</th></tr>"; echo "<tr>"; while ($empty_cell > 0) { echo "<td height='50'><p align='center'> --- </p></td>"; $days_in_week++; $empty_cell--; } while ($days_in_month <= $current_month_total_days) { echo "<td height='50'><p align='center'>".$days_in_month."</p></td>"; $days_in_month++; $days_in_week++; if($days_in_month == $current_day_num) { echo "<td height='50'><p align='center'><font color='red'><b>".$days_in_month."</b></font></p></td>"; $days_in_month++; $days_in_week++; } if ($days_in_week > 7) { echo "<tr></tr>"; $days_in_week = 1; } } echo "</tr></table>"; /* Calendar End */ echo $current_day_name; ?> If anyone can be any help, it'd be greatly appreciated. jiveTurkey420
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.