laide234
Members-
Posts
33 -
Joined
-
Last visited
Never
Everything posted by laide234
-
Here's another sample... might help [code] <?php switch ($page) { case 'submit' : $content = 'submit.php'; break; case 'contact' : $content = 'contact.php'; break; case 'faq' : $content = 'faq.php'; break; default : $content = 'submit.php'; } ?> <head></head> <title></title> <body <table> <tr> <td> <?php require_once 'header.php'; ?> </td> </tr> <tr> <td> <?php require_once $content; ?> </td> </tr> <tr> <td> <?php require_once 'footer.php'; ?> </td> </tr> [/code]
-
**solved** How do I put a variable into a header?
laide234 replied to laide234's topic in PHP Coding Help
Thanks Jenk. -
I have a variable $job_id that contains a numeric value I would like to append to a header. i.e. if $job_id = 5 go to listing.php?view=thanks&job_id=5 Here is what I tried [code]header('Location: listing.php?view=thanks&job_id='echo $job_id;'');[/code] Apperently, this isnt working. Any suggestions?
-
Genius. That did the trick. Thanks a bunch. ;D
-
This might be of some help... http://www.nstoia.com/toh/technical/imageresize/index.php
-
You have 3 if statements back to back.... [code] if (empty($_POST['user'])) && {empty($_POST['pass'])) { echo "Please insert your username"; echo "Please insert your password"; } if (empty($_POST['user'])) { echo "Please insert your username"; } if (empty($_POST['pass'])) { echo "Please insert your username"; }[/code] I dont think you can do that. use if... esle if... esle...
-
Here is the code... [code] <form action="processApp.php?action=apply" method="post" enctype="multipart/form-data" name="apply" id="apply"> <tr> <td><div align="right"><strong>*Applicant's Name: </strong></div></td> <td><input name="name" id="name" type="text" size="40" maxlength="30"></td> </tr> <tr> <td><div align="right"><strong>*Applicant's Email Address: </strong></div></td> <td><input name="email" id="email" type="text" size="40" maxlength="30"></td> </tr> <tr> <td colspan="2"><hr width="350"></td> </tr> <tr> <td><div align="right"><strong>Work Phone: </strong></div></td> <td><input name="wPhone" id="wPhone" type="text" size="40" maxlength="20"></td> </tr> <tr> <td><div align="right"><strong>Home Phone: </strong></div></td> <td><input name="hPhone" id="hPhone" type="text" size="40" maxlength="20"></td> </tr> <tr> <td><div align="right"><strong>Cell Phone: </strong></div></td> <td><input name="cPhone" id="cPhone" type="text" size="40" maxlength="20"></td> </tr> <tr> <td colspan="2"><hr width="350"></td> </tr> <tr> <td><div align="right"><strong>Paste your resume and/or cover letter here</strong></div></td> <td rowspan="2"><textarea name="resume" id="resume" cols="36" rows="10"></textarea></td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> <td><input name="submitApp" id="submitApp" type="image" onClick="validateApply();" src="..//images/submit_app_button.gif" width="120" height="20" border="1"></td> </tr> </form>[/code] When I click on the image, it submits. I was going to add some form validation (and a submit(); )to "validateApply();" , but data is being sent with or without the submit. I even put a simple alert() in validateApply(), just to test it. But I get the alert, and then data is sent. I want to be able to control this with validation and a submit(). I do not want to access processApp.php until I am sure there is data in the fields. What am I missing???
-
*solved* PHP Variable passing (I should be embarrassed)
laide234 replied to laide234's topic in PHP Coding Help
::) Man! I am such a noob.... "(probably simple answer)" I would have never guessed that I didnt need to pass anything. Thank a mill', wildteen88. -
Please take a look at my code below. I would like to pass the variable in $autoNum to whichever of the php pages are loaded (edit, add or delete). autoNum is the primary key [code]<?php switch ($view) { case 'edit' : $content = 'edit.php'; break; case 'add' : $content = 'add.php'; break; case 'delete' : $content = 'delete.php'; break; default : $content = 'edit.php'; } ?> <td width="50%" colspan="2"> <?php echo $autoNum; require_once $content; ?>[/code] How do I send $autoNum to the requested page. :-[
-
Thanks Corona4456. That worked.
-
mysql_select_db(); best practice. your thoughts?
laide234 replied to micah1701's topic in PHP Coding Help
I use a config file, especially when I have mutiple pages accessing the same database. Connecting on every page can be a hassle. I just include the config file. -
I am calling a function in a .js file from a php file. I am pretty sure I am calling my .js file correctly, using [code]<sc**pt language="JavaScript" type="text/javascript" src="../library/job.js"></sc**pt>[/code] and [code]<input name="btnAddJob" type="button" id="btnAddJob" value="List Job" onClick="listJob();" class="box">[/code] However, within my .js file, this function works: function listJob() { window.location.href = 'index.php?view=add'; } But when I modify it to a simple submit, it doesnt work. function listJob() { submit(); } The above code will not respond (I am trying to submit the contents of a form.. I intend on adding some validation before submitting). Again, I am calling the file correctly... It just stops working when I change "window.location.href = 'index.php?view=add';" to "submit();" I would like to know why this is happening.
-
Thanks a bunch, akitchin. Adding the error_reporting() thing to my code suppressed this notice (I just learnt about notices and errors ::)) [code]// Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE);[/code] Still trying to clean up the code so I dont get any notices, but this will more than do for now. Thanks again!
-
Anyone?
-
When I tried $name = $value[$id]['name']; I got multiple errors, all reading: Notice: Undefined index: 966 in /admin/product/modify.php on line 45
-
Notice: Undefined index: name in [b]/admin/product/modify.php[/b] on line 45 (in red text). Any help would be appreciated. My code is below // get category list $sql = "SELECT cat_id, cat_parent_id, cat_name FROM tbl_category ORDER BY cat_id"; $result = dbQuery($sql) or die('Cannot get Product. ' . mysql_error()); $categories = array(); while($row = dbFetchArray($result)) { list($id, $parentId, $name) = $row; if ($parentId == 0) { $categories[$id] = array('name' => $name, 'children' => array()); } else { $categories[$parentId]['children'][] = array('id' => $id, 'name' => $name); } } //echo '<pre>'; print_r($categories); echo '</pre>'; exit; // build combo box options $list = ''; foreach ($categories as $key => $value) { [color=red]$name = $value['name'];[/color] $children = $value['children']; $list .= "<optgroup label=\"$name\">"; foreach ($children as $child) { $list .= "<option value=\"{$child['id']}\""; if ($child['id'] == $cat_id) { $list .= " selected"; } $list .= ">{$child['name']}</option>"; } $list .= "</optgroup>"; }
-
I'm a newbie, so this could be really simple... I have an onClick event attached to my "Add To Cart" button that adds a product to a shopping cart. onClick="window.location.href='<?php echo $cart_url; ?>';" where [b]$cart_url[/b] is [b]cart.php?action=add&p=72[/b] I would also like, when the item has been added to the cart, to go to the parent category page of that item. i.e. when you add a basketball to the cart (from index.php?c=300&p=72) it goes to to the list of sporting goods page (index.php?c=300) onClick="window.location.href='<?php echo $_SERVER['PHP_SELF'] . "?c=" . $catId; ?>';" ...How can I have that one button accopmlish both these tasks?? Please help.
-
Please provide more details on what you are attempting.
-
try smaller files... just to eliminate the possibilty of it being a file size issue. create 'test.mp3' (from a blank text document or something) and upload it. if it uploads, you know what the problem is.
-
you are absolutely right!! it was the path. I had switched directories and forgot to update $dirname = '/images/product/';
-
I think my code is fine. But the images arent even getting to the server. Please take a look at my function: function modifyProduct() { $path = $_SERVER['DOCUMENT_ROOT']; $dirname = '/images/product/'; $chmod = 0755; // create file vars to make things easier to read. $filename = $_FILES['fleImage']['name']; $filesize = $_FILES['fleImage']['size']; $filetype = $_FILES['fleImage']['type']; $file_tmp = $_FILES['fleImage']['tmp_name']; $file_err = $_FILES['fleImage']['error']; $file_ext = strrchr($filename, '.'); $productId = (int)$_GET['productId']; $catId = $_POST['cboCategory']; $name = $_POST['txtName']; $description = $_POST['mtxDescription']; $price = str_replace(',', '', $_POST['txtPrice']); $qty = $_POST['txtQty']; $scost = str_replace(',', '', $_POST['txtScost']); $ropoint = $_POST['txtRop']; $dir = $path . $dirname; $prefix = substr($filename, 0, -4); $thumb = "_t"; $thumbnail = $prefix . $thumb . $file_ext; // if uploading a new image (filename field is not empty) // remove old image if ($filename != '') { _deleteImage($productId); if (@move_uploaded_file($file_tmp, $dir . '/' . $filename)) { $n_w = 240; $n_h = 240; $t_w = 75; $t_h = 75; $o_path = " "; $s_path = " "; Resize_Image($dir . '/' . $thumbnail,$dir . '/' . $filename,$t_w,$t_h,$s_path,$o_path); Resize_Image($dir . '/' . $filename,$dir . '/' . $filename,$n_w,$n_h,$s_path,$o_path); $filename = "'$filename'"; $thumbnail = "'$thumbnail'"; } else { // error moving file. check file permissions. unlink($file_tmp); echo '<strong>Error:</strong> Unable to move file to designated directory.'; } } else { // if we're not updating the image // make sure the old path remain the same // in the database $filename = 'pd_image'; $thumbnail = 'pd_thumbnail'; } $sql = "UPDATE tbl_product SET cat_id = $catId, pd_name = '$name', pd_description = '$description', pd_price = $price, pd_qty = $qty, pd_image = $filename, pd_thumbnail = $thumbnail, pd_scost = $scost, pd_ropoint = $ropoint WHERE pd_id = $productId"; $result = dbQuery($sql); header('Location: index.php'); }
-
You (mewhocorrupts) are right. I was looking for something like this http://www.softcomplex.com/products/tigra_calendar/demo1.html I was just wondering if there was another/easier way, like get_calender, to do this.
-
You, sir, are a godsend! ;D Thanks Daniel0. It worked perfectly.
-
I want users to enter dates into a database, but I would like to control the client side entry with some kind of calendar. can anyone help?
-
I am pulling a date from a database entry. <?php echo $job_date; ?> displays as '2006-08-07 00:00:00' I would like to format the display. But when I use <?php echo date("F, jS Y", $job_date); ?> I get 'December, 31st 1969' . This is the format that I want, but where is it getting December from???