Jump to content

thehubclick

Members
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

0 Neutral

About thehubclick

  • Rank
    Member
  1. Ok ty. I cant get my test <> To work how do i learn on this forum how to embed Is it (< my code. >) Let me know because in my test i did < my code > But it didnt work. Ty
  2. Sorry Not sure how to Use <> my code inside (< <script type="text/javascript"> function sam_click() { var x="<?php ex(); ?>"; alert(x); return false; } </script> >) I cant find the edit to fix my code. So did this test. Ty
  3. <script type="text/javascript"> function checker1() { (tboxinp1.value==000) { alert("error3") } { // call php script from javascript ??? <?php not looking to use alert here is part of the php script to call } <?php /// can I put a function to call this. This php script is taken from my sumbit button. I want to check if condition mets before the submit sends the data $t = $_GET["email"]; echo '<script>checker1()</script>'; if ($t == 1) { // heres submit i want to call from javascript if(isset($_POST['textdata'])) i dont know how to approach this javascript call. Thanks if you can help. What i mean is the <?php script runs when i click submit i want to catch if data was not entered before it submits, if it does not i like the submit to cancel. The php script as follows when submit button is clicked <?php $t = $_GET["email"]; echo '<script>checker1()</script>'; if ($t == 1) { if(isset($_POST['textdata'])) { // return false; session_start(); $cm_name = $_GET["name"]; // Check if a text file exists. // If not create one and initialize it to zero. if (!file_exists($cm_name)) { - $f = fopen($cm_name, "w"); - fwrite($f,"0"); - fclose($f); } // Read the current value of our counter file $f = fopen($cm_name,"r"); $cmVal = fread($f, filesize($cm_name)); fclose($f); // Has visitor been counted in this session? // If not, increase counter value by one if(!isset($_SESSION['hasVisited'])){ - $_SESSION['hasVisited']="yes"; - $cmVal++; - $f = fopen($cm_name, "w"); - fwrite($f, $cmVal); - fclose($f); echo "Have a good day!"; } echo '<script>showname()</script>'; // $data=$_POST['textdata']; // $fp = fopen('data1.txt', 'a'); // fwrite($fp, $data); // fclose($fp); } //echo "Have a good day!"; } // echo '...'; ?>d
  4. Ok im using the Xampp. Program to startup webserver ill see how to turn on error reporting on. I just started using it to test my website before i put it on my paid web hosting .www example:mydomain.com/home1.php thanks This xampp is the best It installs everything php perl so it works correctly Sometimes i forget how to edit php.ini file You know configuration With xampp it makes it all work all you do is start up the webserver 5 stars xampp.
  5. Thank you Barand What you said adding ";" fixed it i left that out Thanks for your help My code works with your all helping Good day.
  6. The working php file when i run in my webserver localhost <!DOCTYPE html> <html> <head> <meta http-equiv="pragma" content="nocache"> <meta name=viewport content='width=1100'> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/> <!--320--> <title>Store form data in .txt file</title> </head> <body> <form method="post"> Enter Your Text Here:<br> <input type="text" name="textdata"><br> <input type="submit" name="submit"> </form> </body> </html> <?php if(isset($_POST['textdata'])) { $data=$_POST['textdata']; $fp = fopen('data.txt', 'a'); fwrite($fp, $data); fclose($fp); } ?> I changed it to now its not running when i run this php On my webserver if(isset($_POST['textdata'])) { $data=$_POST['textdata']; $fp = fopen('data.txt', 'a'); $string1="@@@ " added this Added this $data=$data.$string1; fwrite($fp, $data); fclose($fp); }
  7. hello i am learning php a newbie . i am a perl javascript vb script visual basic. some php. i am tring to put multiple $strings into one then save it to file i need to be abe to split up the data later. my split symbol is "|" or | the second code below is my changes the second code below had errors first code original this code works i tested this it grabbed the clients user input. // this is the user input / textdata if(isset($_POST['textdata'])) { $data=$_POST['textdata']; $fp = fopen('data.txt', 'a'); fwrite($fp, $data); fclose($fp); } ?> second code changes i made. . if(isset($_POST['textdata'])) { $data=$_POST['textdata']; $fp = fopen('data.txt', 'a'); // i added this line $string1="| " // i changed this line below // my error might be here $data=$data.$string1; fwrite($fp, $data); fclose($fp); } ?> can i get help fixing this to work $data=$data.$string1 thank you in advance.
×
×
  • 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.