Jump to content

Reg Edit

Members
  • Content Count

    411
  • Joined

  • Last visited

Posts posted by Reg Edit

  1. Hi, Can I put multiple variables in an ASP file? For instance: ...
    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. here wen B is slected it displays the next level bt tat time question 1 is still being displayed. I guess a diff. approach is needed. :)
    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).

  3. So hide Set A. If you're doing this in javascript, the best bet might be to set it's container div's display to none . Then, you won't have a big empty space where it used to be, but rather Set B and all the other content will move up the page.
    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.
  4. I have tried transferring the result to another page in action and it worked fine.. but is it possible to keep all this in SAME PAGE? is it possible to do in PHP?
    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!
  5. I want to order by second word in the field.I have a query:
    $rez = mysql_query("SELECT `augalas_lot`,`augalas_lt` FROM `herbs_exposition` ORDER BY `augalas_lt`");

    It orders by first word of the field augalas_lt. Example of field augalas_lt:Stambiašaknis snaputisStoralapė bergenijaTamsiažiedė dedešvaTankiažiedė rūgštynėand so on.I can not separate them to different fields. How to make it sort by second word?It should look like this:Storalapė bergenijaTamsiažiedė dedešvaTankiažiedė rūgštynėStambiašaknis snaputisThank you in advance!

    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

  6. if I leave only echo getenv('PHP_SELF')."?language=lt"; after changing the language second time it gives this warning:"Warning: array_key_exists() The second argument should be either an array or an object"I can not leave with &language echo getenv('PHP_SELF')."&language=lt"; also, because language should start with ? but not with &.
    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.

  7. I am tiring to learn php too :)My code was OK, it needs else, because otherwise you can change language only once and later - errors. Once it takes "?language=lt", when it goes to else - "&language=lt". So difference is ? and &.Do you have any ideas how to change location after the flag is pressed to change language?
    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?

  8. 1) I select my filters, the database choices are narrowed. 2) I get multiple pages (a filtered list from the database). 3) I click to go to the second page. 4) The filters reset to their defaults and I end up with the entire database again.
    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.)
  9. if I use PHP_SELF instead of REQUEST_URI, if i use second time the language, it tries to open http://www.jadvyga.lt/&language=lt what means - page not found. It doesn not "keep" the file name.And what would you suggest, if I want to make that after choosing language the location would be changed?
    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.

  10. Good suggestions. I echo the passed string both before the function is called, and from within the function itself. And so I know this part is good. And I never use a for or while loop to parce it. I don't need to parce it. I just need to know if a little string exists within a big string, and if it does, append a value to another string.
    The negation is getting evaluated at the wrong place. Use !== instead of !strpos:
    if (strpos($vPSA, "crue")!==false) ...

  11. I have this simple little function. I pass to it a string such as canc,crue,medi The function is supposed to echo out what these 4 letter words stand for, for all of them in the list. I will get results for everything except the first four letter item in the list. for instance, the string above will returnCruelty-Free Charities: for crueMedical School Live-Animal Labs: for medi but not Cancer Prevention: A Message from . . . for canc, the first four letter word in the list. it acts as though canc was not contained within canc,crue,medi. Why?!?
    function listem($vPSA) {$Video='';if (!strpos($vPSA, "crue")===false) {$Video .= '<li>Cruelty-Free Charities: Humane Seal of Approval (Noah Wyle)</li><br />';}if (!strpos($vPSA, "vdel")===false) {$Video .= '<li>Vegetarian Diet: El Poder de la Alimentación</li><br />';}if (!strpos($vPSA, "canc")===false) {$Video .= '<li>Cancer Prevention: A Message from Anthony Hopkins</li><br />';}if (!strpos($vPSA, "medi")===false) {$Video .= '<li>Medical School Live-Animal Labs: Don’t Let Your Medical Education Go to the Dogs (Bill Maher)</li><br />';}echo $Video;}

    I also tried )>0) instead of ! ===false. I know the string is recieved properly by the function because I can echo it to the screenHow do I tell it to see the first part of the string? I am going to go bang my head aginst the wall some more now.

    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.
  12. 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>"

  13. However, I want to compare two strings come from two different .txt? I tried your proposal, but position() can't pass the value of the current node.
    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.
  14. I'm not sure how to edit this code to point to my express database. Also, would I put this at the top of EVERY form that accesse's the database, would it go in the web.cofig file and if so where, or can I do a file that then all other pages look to.
    Any webform accessing the database needs code similar to that.
    The faq talked about connecting the mssql database on their server not to the mssql express one that I have uploaded (my understanding is that mssql express can be uploaded to sit in a folder in the root directory and doesn't need to be imported into the mssql database).
    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.
  15. Is Visual Web Developer 2005 Express Edition meant to only be used on my local computer with SQL Server 2005 Express Edition or can it be used on the server as well.
    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).
  16. I'm not sure what you meant by

    The only database that I can upload is an Access database
    because you had said you'd changed it to a SQL Express one:
    I foudn the 1and1 does support asp.net but not with links to an access database, which mine was so I'm assuming that is why I had write errors. I redid the form with a link the SQL Server Express Edition 2005 table and still received a server error.
    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.
    Now I'm getting this error 26 related to connecting the database. After reading online re this error I found that not all hosting companies support sql server express. I contacted my hosting company and they support sql server 2005 and stated that the asp file needs to connect to that database.
    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.
  17. Source File: E:\kunden\homepages\28\d196566577\campcarekids\asp.net files\web.config Line: 58
    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.
  18. ixwebhosting allows me to set up my odbc connections with I did and they've assured me that they've done their part to allow the files to be written to. 1and1 had a webfile utility that allows me to edit writing privileges which I have already done. The thing that confuses me is that I am able to view the table data so I know the connection is being made, I can't edit it or write to it.
    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.

  19. 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.

  20. I presume your viewing it locally? If so, IE does that when viewing web pages locally when you have javascript on your pages.When uploaded to a server, it should disappear.Hope that helps:)
    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.
  21. Learn JavaScript. Don't learn VBScript.
    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.
  22. Umm, i was not running acess while i run the page. must be the file is missing , how do i get it if it is really missing?
    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?
    about the mysql and sql yeah i like to go to them but i am not quite familiar with them. I want to go to php too, but getting into asp first i have no idea how do i start learning 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...