Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    can you print out your $sql query to see if it is formed as you expect?
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  2. #17
    Regular Coder
    Join Date
    Apr 2013
    Posts
    136
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question

    here is my page, still not getting into the if(isset($_POST['submit'])){ bit

    PHP Code:
    <?php
    session_start
    ();

    mysql_connect("xxx""xxx""xxx");
    mysql_select_db("xxx");

    $id $_REQUEST['id'];

    $query1 "SELECT * FROM app1_blog";
    $result1 mysql_query($query1);

    $qry="SELECT id,title,date,article,image1,image2,image3 FROM app1_blog WHERE id = '$id'";
    $cur=mysql_query($qry);
    while(
    $i=mysql_fetch_row($cur))
    {
    $id=$i[0];
    $title=$i[1];
    $date=$i[2];
    $article=$i[3];
    $image1=$i[4];
    $image2=$i[5];
    $image3=$i[6];
    }





    if(isset(
    $_POST['submit'])){
    echo 
    'hello: ';
    $new_title=mysql_real_escape_string(stripslashes($_POST["title"]));
    $new_article=mysql_real_escape_string(stripslashes($_POST["article"]));
    echo 
    $new_title;
    }
    //$sql = "UPDATE app1_blog SET title='$new_title',article='$new_article' WHERE id = '$id'";

    //$msg = 'Blog edited';
    //$result = mysql_query($sql,$link) or die('Error: ' . mysql_error() . '<br>SQL: ' . $sql);

    //header("Location: edit.php?msg=$msg&id=$id");






    ?> 
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
      <meta name="apple-mobile-web-app-capable" content="yes">
      <meta name="apple-mobile-web-app-status-bar-style" content="black">
      <title></title>
      
      
      
      <link rel="stylesheet" href="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.css">
      
      <!-- Extra Codiqa features -->
      <link rel="stylesheet" href="codiqa.ext.css">
      
      <!-- jQuery and jQuery Mobile -->
      <script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
      <script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

      <!-- Extra Codiqa features -->
      <script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
       
    </head>

    <body>
    <!-- Home -->
    <div data-role="page" id="page<?php echo $id;?>">
        <div data-theme="a" data-role="header">
            <h3>
                Edit blog post
            </h3>
        </div>
        <div data-role="content">
            <h2>
                Blog
            </h2>
            <form method="post" action="<?php print $_SERVER["PHP_SELF"]; ?>" name="form">
            <div data-role="fieldcontain">
                <label for="textinput1">
                    Title
                </label>
                <input name="title" id="textinput1" placeholder="" value="<?php echo $title;?>" type="text">
                <input name="id" placeholder="" value="<?php echo $id;?>" type="hidden">
            </div>
            <div data-role="fieldcontain">
                <label for="textinput2">
                    Date
                </label>
                <input name="date" id="textinput2" placeholder="" value="<?php echo $date;?>" type="text">
            </div>
            <div data-role="fieldcontain">
                <label for="textinput3">
                    Article
                </label>
                <textarea name="article" id="textarea1" placeholder=""><?php echo $article;?></textarea>
            </div>
                <img src="<?php echo $image1;?>" alt="image" width="288" >
                <img src="<?php echo $image2;?>" alt="image" width="288" >
                <img src="<?php echo $image3;?>" alt="image" width="288" >
            <input data-theme="b" name="submit" value="submit" type="submit">
            </form>
        </div>
    </div>
    </body>
    </html>

  3. #18
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by jarv81178 View Post
    I'm sorry TangoForce but I didn't see your signature... duh, silly me!

    As for debugging.... I have been doing lots of that, I tried echoing out 'Form submitted' inside the conditional for isset submit
    Quote Originally Posted by jarv81178 View Post
    here is my page, still not getting into the if(isset($_POST['submit'])){ bit
    You've not seen my signature and yet today when I point it out you've still ignored it

    READ IT. CLICK THE LINK. WATCH THE VIDEO.

    Then you will see why your code is not working in the isset($_POST['submit']).

    See this is your problem Jarv. People tell you things and you ignore them. If you read my signature properly and investigated by reading the topic, you would have solved this yourself by now.

    Your problem is that you're not sending the submit button in your form and thus you will not enter that section of code.
    Last edited by tangoforce; 07-13-2013 at 09:59 PM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  4. #19
    Regular Coder
    Join Date
    Apr 2013
    Posts
    136
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question

    can anyone help me here?

  5. #20
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by jarv81178 View Post
    can anyone help me here?
    Hmm, just in case I didn't already post this:
    This is a JS problem. It submits fine when JS is disabled. Fix your JS problem.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  6. Users who have thanked Fou-Lu for this post:

    tangoforce (07-15-2013)

  7. #21
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by Fou-Lu View Post
    Hmm, just in case I didn't already post this:
    This is a JS problem. It submits fine when JS is disabled. Fix your JS problem.
    I'm no JS man and certainly had no idea there was any involved with the form (on a php forum you expect it to be php and I didn't see a lot of JS in the code).

    Anyway good catch Fou. I'm crawling under my rock lol.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  8. #22
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Haha, a little troubleshooting would have been nice.
    I always run with noscript, so when it works I enabled it and found it did not. So its definitely the JS that's the cause.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  9. #23
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Good tip Fou-Lu
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  10. #24
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by Fou-Lu View Post
    Haha, a little troubleshooting would have been nice.
    I don't do JS!

    Either way my advice to jarv still stands, don't use the submit button in your php code!
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  11. #25
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by tangoforce View Post
    I don't do JS!

    Either way my advice to jarv still stands, don't use the submit button in your php code!
    I meant troubleshooting from jarv.
    This should have been isolated as being a problem with PHP before saying its a PHP problem. This is why so many web developers have got to stop using JS *during* the development cycle. JS should be added after everything works unless there is an extreme reason to use it, JS should be assumed as not available.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  12. #26
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by Fou-Lu View Post
    I meant troubleshooting from jarv.
    You have more chance of me becoming a good front end designer
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •