Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SpikeZ

Members
  • Joined

  • Last visited

Everything posted by SpikeZ

  1. Pretty well what the error message said! Foreach iterates through an array, if you dont give it an array then it cant iterate and throws the error.
  2. in your form simply use the action attribute: <form name="contactForm" id="contactForm" action="http://myPHPserver.com/formProcess.php">
  3. You are welcome
  4. Darren, you need to JOIN the tables on their common fields and alias them. This probably wont run as is because I dont know your field names but it should give you an idea. select t1.product_id as t1_p_id , t1.product_name as product_name , t2.product_id as t2_p_id , t2.category_id as t2_cat_id , t3.category_id as t3_cat_id , t3.category_name as t3_cat_name from table_1 as t1 left join table_2 as t2 on ti_p_id = t2_p_id left join table_3 as t3 on t2_cat_id = t3_cat_id
  5. If you have access to an different php enabled server you could direct the form action to that server instead. Then process the form and redirect back to the original site. Bit of a hack but it works.
  6. Hi, you cant start a class definition with a number so .64x64 wont parse properly. Change it to .div64x64 and amend your HTML code accordingly and it will work fine
  7. SpikeZ replied to robcub's topic in Server Side
    http://uk3.php.net/uniqid read the user submitted notes.
  8. TBH I did the same! Wasnt until I set it up on a testbed that I noticed.
  9. hey Drew Answered this on SitePoint but will post here too. You have: <input name="userfile[]" type="file" /> remove the [] as it creates a multidimentional array when the form is subitted. That kills the error checking.
  10. phpDesigner 2008 for me, there are 2 editions - personal which is FREE and Pro which has a small fee. Tons of features if you want them as well as project management, file management and auto complete.
  11. Hi again DFT, The problem stems from the location of the first $result variable. It is inside the first if() clause and so will only exist IF the form has been submitted. You then call the variable outside of the if() before the form has been submitted and so the variable hasnt been created yet - giving you the error. I would guess that moving the { on line 10 down to where the else is on line 16 would do the trick. <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); if ($result) { echo "<meta http-equiv=Refresh content=0;url=index.php>"; } } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '300'; $oFCKeditor->Create(); } } ?>
  12. Hi again DFT, The problem stems from the location of the first $result variable. It is inside the first if() clause and so will only exist IF the form has been submitted. You then call the variable outside of the if() before the form has been submitted and so the variable hasnt been created yet - giving you the error. I would guess that moving the { on line 10 down to where the else is on line 16 would do the trick. <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); if ($result) { echo "<meta http-equiv=Refresh content=0;url=index.php>"; } } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '300'; $oFCKeditor->Create(); } } ?>
  13. Have a look at http://uk.php.net/htmlspecialchars(). it converts charcters to their html entities
  14. That seems a more than logical idea
  15. You are most welcome DFT
  16. Hi Webchap, if usera is the general public/surfers then you dont set anything up in the cpanel - they dont need it. There are a couple of ways to achieve what you want, 1/ Apache - setting up in cpanel a members/admin area using htaccess passwords 2/ Use the database to store username, password and auth levels of administrators. Either way will work but for me the database is the more logical and easier to manage (in my opinion!) Is that what you are aiming for or have I misinterpretted you?!
  17. yes the usage is correct but the syntax is: if ($result) { header("Location: " . $_SERVER['PHP_SELF']); exit(); } PHP_SELF is all uppercase and stcik an exit() in to stop any further processing below the header.
  18. The $listing is an array so you can check the size of it before running the foreach loop. if(count($listing) != 0) { // run it } else { //echo the 'Nothing in your area' message }
  19. Interesting articles ElanMan but surely it would be easier to just use header("Location: xxxx.php"); and direct the user to a thank you page? This destroys the POST data and removes the refresh problem entirely. See www.php.net/header
  20. Sorry Anna, I was working from home yesterday and didnt get back over here. Glad you got it working
  21. Hi guys, the problem is that headers can only be called before anything - absolutely anything is sent to the browser. That anything can be whitespace before your opening <?php tag, html or javascript. Basically nothing can be sent before them. You can process anything you like before it as long as it doesntget sent to the browser. So, DFT; Yours is a simple fix in that you can move the <form> tag and line below the <?php ?> area and it will be fine, just make sure that the <?php is on line 1, column 1 of your file. HTH Spike
  22. Hi Josh, change: $target_path = "uploads/"; to $target_path = $_POST['list'] .'/'; so that the form field called 'list' is used for the location. I would personally avoid using names like list as it is a function name as well.
  23. easiest way would be: echo "<table><tr>"; foreach(glob("images/*.{jpg,JPG,jpeg,JPEG,gif,GIF,png,PNG}", GLOB_BRACE) as $images) { $filename = $images; $title= explode(".", basename($images)); echo "<td><a href=\"".$images."\" rel=\"lightbox[holiday]\" title=\"".$title[0]."\"><img src=\"".$images."\" width=\"100px\"></a><br/>"; } echo "</tr></table>"; HTH Spike
  24. working well anna, glad you got it sorted out btw, because you are using the javascript redirect you can remove these lines: <form action="page_2.php" method="get" name= "myform"> <input type="image" name="image" /> <input type="hidden" name="dur" value="dur" /> </form>
  25. Hi Richard, yes you are correct in thinking that PHP/MySQL are right for this job. You could also use .NET etc but PHP is far easier. You could use a premade CMS such as Joomla which will have modules for adding images and details or you can sit down and learn it all from scratch! From scratch is far better IMHO as you can fix and add to it if you need to and more importantly you will understand what is happening. You will need basic sql knowledge only - insert and update, dont delete anything! Instead of deleting, set a marker field to a boolean 0 or 1 for visible or invisible. So if the record is to be displayed the field is 1, if its 'deleted' its set to 0. For the PHP side of things the main one to look at is uploading the images. You will have to decide; 1/ Are you going to generate thumbnail images when you upload them or display them 2/ Are you letting the client upload the images - if so prepare yourself for MASSIVE images straight from a digital camera! 3/ How the images are going to be displayed on the page. (thumbnails/lists etc) When you upload the image, avoid putting the image into the database. Put the image into a folder and put the image name into the database, make managing it soo much easier. Other than than, basic knowledge of forms and HTML shoudl see you through nicely Good luck Spike

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.