Jump to content

chris-newman

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chris-newman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Building an internet based database containing electoral roll info. Particulars: Database mySQL, PHP4 on server, HTML and CSS on client. The question relates to displaying user messages. Validating input done by the usual JS which checks if all fields are empty and if so switches CSS properties to display a message.  Know it is possible to populate refresh content on webpage remotely using AJAX though granted this requires the click of a button. Want to use same mechanism to inform user if search unsuccessful without having to load a different page or reload the same one. Need to pass the field values to the server to complete the query using GET or post but could also use AJAX. Won't know if search fails until I test the number of rows returns from SQL query. Is it possible to invoke a javascript function over AJAX from within a PHP script?
  2. Building an internet based database containing electoral roll info. [b] Particulars[/b]: Database mySQL, PHP4 on server, HTML and CSS on client. The question relates to displaying user messages. Validating input done by the usual JS which checks if all fields are empty and if so switches CSS properties to display a message.  Know it is possible to populate refresh content on webpage remotely using AJAX though granted this requires the click of a button. Want to use same mechanism to inform user if search unsuccessful without having to load a different page or reload the same one. Need to pass the field values to the server to complete the query using GET or post but could also use AJAX. Won't know if search fails until I test the number of rows returns from SQL query. Is it possible to invoke a javascript function over AJAX from within a PHP script?
  3. [quote author=wildteen88 link=topic=107077.msg429081#msg429081 date=1157538584] If you want to include parts of the file, you'll want to seperate your code into functions, for example. You have a form. You put all the code for the form in a function called showForm, like so: [code=php:0]// define the function showForm function showForm(); {     // we echo the HTML for the form     // Below is HEREDOC syntax     echo <<<HTML <form action="file.php" method="post">   your form fields here </form> HTML; // DO NOT INDENT OR PUT ANYTHING ON THE LINE ABOVE }[/code] Now to call the function you use: [code=php:0]showForm();[/code] When you call this function, it'll produce this: [code]<form action="file.php" method="post">   your form fields here </form>[/code] Which will allow for reusable code. [/quote] Thanks Will give it a go  ;D ;D ;D
  4. That wasn't quite what I meant. Can I have a file file.php with an statement that *includes* part of that file.
  5. I am wanting to keep my scripts neat and tidy and a few as I need to get the job done. I am building a search engine with elements such as forms. banners etc, some of which I want to reuse. is one of the stated benefits of languages such as PHP is I can reuse the code. I am using the include() function. However this only includes HTML code stored in a separate file. Question: Is this someway to include the HTML stored in the calling file? This will reduce the number of files I need to manage. Any help would be appreciated.
×
×
  • 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.