Jump to content

KDragon

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

KDragon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=388328:date=Jun 26 2006, 10:43 PM:name=JohnnyK)--][div class=\'quotetop\']QUOTE(JohnnyK @ Jun 26 2006, 10:43 PM) [snapback]388328[/snapback][/div][div class=\'quotemain\'][!--quotec--] $result=mysql_query("INSERT INTO $tableName (confirm_code,email) VALUES($confirmCode,$_POST['client_email'])"); [/quote] that gives me a new error, same line: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
  2. I keep getting this error: Parse error: syntax error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING with this line of code: $result=mysql_query("INSERT INTO $tableName(confirm_code,email)VALUES($confirmCode,$_POST[\"client_email\"]"); I have no idea why, can somebody help me out?
  3. [!--quoteo(post=384479:date=Jun 16 2006, 03:36 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 16 2006, 03:36 AM) [snapback]384479[/snapback][/div][div class=\'quotemain\'][!--quotec--] What do you need this for? I mean in any case it's much better not to have a function checking if the database exists every moment. [/quote] I don't really need it. I just wondered if it could be done. I don't need it to check every moment. Just every time I have to write something to a particular database.
  4. I know of the functionality of some of php's built-in functions that allow you to write to a file and if the file doesn't exist it will create it. I would like to do this same thing with a database. Most people just say to use phpMyAdmin to create the databases first but this seems a little convoluted and it seems to me I should be able to just write or find a php function that can create a database if and only if it isn't already created. I could use phpMyAdmin but does anyone know of way of doing what I want to do?
  5. I've got this code that does pretty much what I would expect it to do, which is print out the same text over and over, darkening each line of text from white to black. Now that I got that to work I was going to move on to building an algorithm to fade the same line of text from white to black. But i realize that part of my algorithm would probably be printing out the text at the color it's at and then replace it with the next darkest shade of text. So before I go about writing this next step of my code, i would just like to know if it's even possible to do this with purely PHP and no help from any javascript etc. Basically, is it possible to echo something out to the page for some period of time, remove it and replace with something else??
  6. Well, I wrote this php page and when i try to load it just sits there saying that it's transferring data from localhost (the server is on my comp). I'm pretty sure the following code is trying to do what I want it to do, which is change the text color from white to black (incremently, which is why I put it in a loop). I would just like to know why it doesn't load and just keeps transfering data. [code] <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php function colorDec($colorNum){   $colorNum--;   return $colorNum; } ?> <?php $colorNum=255; ?> <p style="color: rgb(<?php while($colorNum > 0){echo colorDec($colorNum);} $colorNum=255; ?>,<?php while($colorNum > 0){echo colorDec($colorNum);} $colorNum=255; ?>,<?php while($colorNum > 0){echo colorDec($colorNum);} ?>)">This be some text.</p> </body> </html> [/code]
  7. [!--quoteo(post=367618:date=Apr 23 2006, 01:31 AM:name=mb81)--][div class=\'quotetop\']QUOTE(mb81 @ Apr 23 2006, 01:31 AM) [snapback]367618[/snapback][/div][div class=\'quotemain\'][!--quotec--] My bet would be that if you view the source of the file, it will look like this: [code] <p style="color: rgb(,,);">This be some text.</p> [/code] Change your line to this: [code] <p style="color: rgb(<?php echo $colorNum; ?>,<?php echo $colorNum; ?>,<?php echo $colorNum; ?>);">This be some text.</p> [/code] and it should work. [/quote] Oh gosh I'm dumb. I'm sorry :(. My brain must be totally just ahhh today. Thank you for your help.
  8. Why isn't the text this document displays, white? I have a variable representing each value of the rgb specification of the color white. I set the variable to 255 but the text always shows up black. Can anybody please explain why? Here's the code: [code]<?php $colorNum=255; ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p style="color: rgb(<?php $colorNum; ?>,<?php $colorNum; ?>,<?php $colorNum; ?>);">This be some text.</p> </body> </html> [/code]
  9. [!--quoteo(post=364318:date=Apr 13 2006, 03:52 AM:name=BladeMetal)--][div class=\'quotetop\']QUOTE(BladeMetal @ Apr 13 2006, 03:52 AM) [snapback]364318[/snapback][/div][div class=\'quotemain\'][!--quotec--] sure, $_POST is a super global, but it is used to access values from ONE page to another. You can't then go to a second page and expect the $_POST variables to stil work. The scope of $_POST is for the page referenced to in <form action="page.php"> meaning that only page.php can access the $_POST array values from the form. [/quote] Yeah, I have my form referencing the current page for it's action. So why would scope be a problem?
  10. [!--quoteo(post=364298:date=Apr 13 2006, 02:18 AM:name=bonaparte)--][div class=\'quotetop\']QUOTE(bonaparte @ Apr 13 2006, 02:18 AM) [snapback]364298[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try this: <?php function showForm(){ extract($_POST); ?> <form method="post" action="<?PHP echo $_SERVER['PHP_SELF']; ?>"> ........... ........... ......... The problem is with the scope of the variables. [a href=\"http://in2.php.net/manual/en/language.variables.scope.php\" target=\"_blank\"]http://in2.php.net/manual/en/language.variables.scope.php[/a] [/quote] I tried that and it didn't work. I'm not totally sure but I don't think scope is the problem because POST is a super global.
  11. I really have no idea why in the following script, all the fields in the form reset after I submit. I've looked at about 20 tutorials about this and they all say to do the same thing that I believe I'm doing...that is to make the value attribute of the various fields = to <?php echo $_POST['varname'] ?>. For some reason it doesn't work at all. To test it I've echoed one of the variables (the $client_email one) several times along the running of the script to see if it was being unset anywhere but it came back with the string it was set to every time, except in the form which is where I want it. Can anybody please help? [code] <?php         function showForm(){ ?>         <form method="post" action="<?PHP echo $_SERVER['PHP_SELF']; ?>">         <div>         <font class="formtitle">Choose a type of avatar:</font>         <br>         <input type="radio" name="avatar_type" value="normal ">         Normal         <br>         <input type="radio" name="avatar_type" value="animated">         Animated         <br>         <br>         <font class="formtitle">Text desired on avatar:</font>         <input type="text" size="50" name="avatar_text" value="<?php echo $avatar_text ?>">         <br>         <br>         <font class="formtitle">Desired dimensions (not required):</font>         <input type="text" size="25" name="desired_dimensions" value="<?php echo $desired_dimensions; ?>">         </div>                  Remember that a picture is worth a 1000 words and accordingly one should give a detailed description of what is desired in the following Description Area:           <br>           <textarea name="description_area" rows="10" cols="70"><?php echo $description_area; ?></textarea>           <br>           <br>           Your email:             <input type="text" size="40" name="client_email" value="<?php $client_email; ?>">           <br>           <br>           <input type="submit" name="submit" value="Send Request">           </div>           </form>          <?php }         ?>         <?php         function showThankYou(){           echo 'Thank you for your request. An email asking you to confirm your request                  should be sent to you shortly.';         }         ?>                  <?php         function checkEmail($email){        $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';        $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';        $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.            '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';        $quoted_pair = '\\x5c\\x00-\\x7f';        $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";        $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";        $domain_ref = $atom;        $sub_domain = "($domain_ref|$domain_literal)";        $word = "($atom|$quoted_string)";        $domain = "$sub_domain(\\x2e$sub_domain)*";        $local_part = "$word(\\x2e$word)*";        $addr_spec = "$local_part\\x40$domain";        return preg_match("!^$addr_spec$!", $email) ? 1 : 0;    } ?>       <?php //declaring variables         $avatar_type=$_POST["avatar_type"];         $avatar_text=$_POST["avatar_text"];         $desired_dimensions=$_POST["desired_dimensions"];         $description_area=$_POST["description_area"];         $client_email=$_POST["client_email"];         $submit=$_POST["submit"];         $category='avatar';         $checker=false;         $subject="Request Confirmation";         $message="<h1>HTML E-mail</h1>                   <p>This is an <b>HTML</b> e-mail.</p>";         $headers = "MIME-Version: 1.0\r\n";         $headers.= "Content-type: text/html; charset=iso-8859-1\r\n";         $headers.= "From: $from\r\n";         $from="FROM:  <asukafan85@yahoo.com>"; ?>       <?php       if(isset($submit)){         if(empty($avatar_type)){           echo 'Please select a type of avatar.'; ?>           showForm();<?php           unset($submit);           $checker=true;           }         //check email         if(checkEmail($client_email)==0){           echo 'Please enter a valid email address.';           $checker=true;         }         //shows thank you message if everything is ok         if(!$checker){           showThankYou();           mail($client_email,$subject,$message,$headers);         }       }       else{         //display form         showForm();         }       ?>[/code]
×
×
  • 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.