Jump to content

Reg Edit

  • Posts

  • Joined

  • Last visited

Everything posted by Reg Edit

  1. Yes you can, but not more than once with the same name! A variable declaration is global in your page (unless withina function). So in your example you would either need to reuse the same variable without declaring it again:<%dim namename="Donald Duck"response.write("My name is: " & name)%><%name="Darkwing Duck"response.write("My name is: " & name)%> or alternatively, in cases where you need a separate variable, declare it with a different name: <%dim namename="Donald Duck"response.write("My name is: " & name)%><%dim name2name2="Darkwing Duck"response.write("My name is: " & name2)%>
  2. It's Flash you need to look at: http://www.w3schools.com/flash/default.asp
  3. The approach is fine, now you just need a way to discern which state you are dealing with: either the page is being rendered for the first time (so Set A needs rendering), or a form has been submitted (so a different set needs rendering instead). I've given an example below of how you could do this. You can count the number of elements in the $_POST array to find out whether it's a postback:if (count($_POST)==0){ // Nothing's been posted: initialise page by rendering A. print '1. what do you choose? <br /><br /> <input type="radio" name="r1" value="b" /> B <br /> <input type="radio" name="r1" value="c" /> C <br /> <br /> <input type="submit" name="submitA" /><br /><br />';}else{ // Something's been posted. See what to render next instead of A. if ($_POST['submitA']) { // A submitted: render B or C. (Example renders B only for simplicity) echo 'This is B<br>'; echo '<input type="submit" name="submitB" />'; } else if ($_POST['submitB']) { // B submitted: render Z. // (Other Z details here) echo 'This is Z<br>'; echo '<input type="submit" name="submitZ" />'; } else if ($_POST['submitZ']) { // Z submitted echo 'The end'; }} In this example I've given the submit buttons different names (submitA etc) to tell which state we're in. As to the javascript/php question, both are well worth learning as they are both needed for different things (javascript for client-side scripting, and php for server-side scripting).
  4. On the other hand, if you're doing it in php, your php logic just needs to avoid emitting the html for Set A at those times. Either way, sounds like good progress already. You just need to finish the logic to only display part A when appropriate. If that's giving you trouble, post the code here so we can suggest a fix.
  5. As you want to submit after each choice, then yes, you can do it with php using the same page. Using php, the html contents of that page are dependent on your php code, and you can include logic in that code that looks at what's been submitted and emits the next question. So rather than hiding page content, it becomes a question of deciding page content.You'll need to look at the details of exactly how you want to do this, but the rough idea is to examine the form fields submitted: and if A has been submitted with the first radio button selected, write out the html for B, but if it's the other radio button, write out the html for C instead. Should be a useful php learning exercise for you!
  6. Well, the data really should be persisted as two separate columns. However, if you insist, you can do it with a query such as the one below, but it's not a very good practice in my opinion! Also it is subject to problems if any data is inconsistent.In this example the table is categories, and the two words are in the description column: SELECT description, right( description, length( description ) - locate( ' ', description ) ) rhtextFROM categoriesORDER BY rhtext
  7. I have now seen PHP_SELF used in different ways and also now read that it may not be reliable. I have also seen it as $_SERVER[php_SELF] which is different from what I saw before.As a test, try hard-coding the URL for both hrefs: http://www.jadvyga.lt/?language=lt http://www.jadvyga.lt/?language=en Assuming you get that working, you can then sort out the right function for deriving the URL afterwards.
  8. The problem is that by using if/else, you are adding more and more to the query string every time after the first time, so it can become ?language=en&language=lt&language=en&language=lt That's why I suggested PHP_SELF plus ? every time. I think it should work. What problem are you having?
  9. You need to maintain some kind of context for the user's current session, and refer to it when the page loads, so that you can set the filters correctly for the current state. Assuming this is classic ASP, you should probably use ASP session variables for this. (If it's ASP.NET there are other ways such as viewstate and controlstate which you should look into.)
  10. Sorry, I missed that... I think you don't need the if statement any more. So instead of if (count($HTTP_GET_VARS)==0) echo getenv('PHP_SELF')."?language=lt"; else { echo getenv('PHP_SELF')."&language=lt"; } you would just need echo getenv('PHP_SELF')."?language=lt"; and the same for the other if statement.WARNING: php is something I am only just learning myself!!! I mainly use MS stuff.
  11. Reg Edit

    strpos nightmare

    The negation is getting evaluated at the wrong place. Use !== instead of !strpos:if (strpos($vPSA, "crue")!==false) ...
  12. Reg Edit

    strpos nightmare

    Have you checked the code that calls this function? I think you may find the problem there. Not knowing the details of how you get the value from your comma-separated list, perhaps you are doing a loop starting from 1 instead of 0, or that kind of thing, missing the first value, so your function is never called with "canc".Try hard-coding a call to the function passing the value "canc", to test your function in isolation from the calling code.
  13. A couple of points: - don't embed an element with an onclick handler within an anchor; use either onclick or href, not both. - don't append a querystring variable to the full URI since that already contains a querystring. You are appending more and more text such as ?language=en?language=it to the URI.Try the following, which usees PHP_SELF instead of REQUEST_URI, and doesn't need the javascript function since the href takes care of the click event: echo "<a href=\""; if (count($HTTP_GET_VARS)==0) echo getenv('PHP_SELF')."?language=lt"; else { echo getenv('PHP_SELF')."&language=lt"; } echo "\" ><img src=\"images/lt_flag.gif\" border=\"1\"></a> <a href=\""; if (count($HTTP_GET_VARS)==0) echo getenv('PHP_SELF')."?language=en"; else { echo getenv('PHP_SELF')."&language=en"; } echo "\"><img src=\"images/en_flag.gif\" border=\"1\" /></a>"
  14. If you want the position of the current node, use boen_robot's example. If you want the value of the current node, use my example. If still stuck please can you explain what you need the xsl to achieve.
  15. Watch out for the typo in that line ("sting"); however, I think you may mean <xsl:when test=". = '$sql'"> to test the value of the node at the current position.See also http://www.w3schools.com/xsl/xsl_choose.asp.
  16. Any webform accessing the database needs code similar to that. Something needs clarifying here! The word database is frequently used indiscriminately for database server as well as database, and it can be very confusing. Consider: if you have SQL Express on your local box, that is a database server (or engine). Using it, you might create a database which you call DB1, and then you might create two more databases, DB2 and DB3. These are SQL Server 2005 databases.When you deploy your database you are not deploying SQL Express, because SQL Express is a database engine. What you are deploying is a SQL Server 2005 database. According to the 1and1 faqs, you need to create a backup (.bak) of your database and import it into their database server by following the instructions at How to import my Microsoft SQL database into 1&1 Microsoft SQL Server.
  17. Your hosting company has a webserver (IIS) that supports ASP.NET. Therefore, if you develop an ASP.NET website and deploy it to that webserver, it will work. This is true regardless of the development tool you use to create your website (for example, Visual Studio or Visual Web Developer).Similarly: your hosting company runs one or more instances of the SQL Server 2005 database engine. So if you create a SQL Server 2005 database (.mdf file) and deploy it to the hosting company (following their instructions to attach it), it will work. This is true regardless of the SQL Server 2005 edition you use to create your database (for example, SQL Express or SQL Server 2005).
  18. I'm not sure what you meant by because you had said you'd changed it to a SQL Express one: I'm assuming you created a database using SQL Express and deployed it according to your hosting company's instructions. If not, you should now do that. Fine--because a database created with SQL Express is fully compatible with SQL Server 2005! You just need to stop referring to SQL Express in your connection string. Set the connection string according to your hosting company's instructions.
  19. This error is happening for the following reason. Assuming your hosting service have done their job, they will have defined an application in IIS to correspond to your root folder. Therefore the implication is that you have deployed your ASP.NET app to a subfolder. This will not work. In environments where you have access to IIS, such as on your local box or a server where you have full control, you can use subfolders and configure IIS to use them. But otherwise you must deploy to the web root folder.
  20. OK, so you have set up the connection string as you showed, and it is working, at least to let you view the data, so the problem may well be something else such as the writing privileges or a coding bug. We can't see what yet, because the "server error" you've posted shows that the error details themselves are being suppressed to suit a live environment. So you need to tweak your web.config to allow the error details to be displayed while you are trying to solve the problem. That's what it's trying to tell you. Inside the <system.web> configuration element, add a <customErrors> element (or edit any existing <customErrors> element) to look like this:<system.web>... <customErrors mode="Off"/>...</system.web> Then retry. The "server error" will then include the error information, with details of what the actual error is.
  21. I notice you didn't mention the connection string so I would assume that is your problem. On your local box, your connection string will be configured for the location of your Access Db somewhere on your C: drive. When you deploy the site to a remote host, you need to set the connection string to suit that environment. You need to check out the hosting service's own documentation about Db connection strings, as it depends on where they locate your Db and so forth.If you still have problems, look again at the detail of the "server error" as that contains the reason. Post that server error text here if still stuck.
  22. Also it only does it when you browse the file system. If you set the folder up as a website in your local webserver, and browse it via your localhost, it stops doing it. I find it's worth doing that during development.
  23. I don't know about JDOM, but to embed html in xml you have to take special action or the xml is not well-formed. Your solution probably involves the use of CDATA and/or replacing "<" and ">"; please do a quick search about this to understand the issue and decide on a strategy that suits your JDOM world. For instance see:http://biglist.com/lists/lists.mulberrytec...8/msg00144.htmlgoogle
  24. Yes.Also don't confuse VB.NET and VBScript. They are totally separate things. When you start using ASP.NET 2.0, whether in VB.NET or C#.NET, it will be better for you if you have never used VBScript.
  25. I doubt if it's missing so much as not found. I seem to remember something about an INI file where you could define where to find the workroup file... don't know off-hand whether that's relevant to a web app. The answer is sure to be in the MS references--have you consulted them? Exactly the same way you're currently learning about Access Workgroups: search online, try things out, ask specific questions when you're stuck. Same way of learning, but far more point in doing so (and far more chance of finding solutions in forums).
  • Create New...