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 4 of 4 FirstFirst ... 234
Results 46 to 50 of 50
  1. #46
    New Coder
    Join Date
    Aug 2012
    Posts
    22
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi Guys,

    Still unable to find a fix for the above problem. Any suggestions?

    I really appreciate you help once again

    Regards,
    mohammedsali

  2. #47
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by mohammedsali View Post
    Hi Guys,

    Still unable to find a fix for the above problem. Any suggestions?

    I really appreciate you help once again

    Regards,
    mohammedsali

    Echo out the value of $start. On the 1st page it should be 1, 2nd page 26.

    PHP Code:
    $start MAX_REC_PER_PAGE * ($page 1); 

    ---
    Leonard Whistler

  3. #48
    New Coder
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Try this:

    PHP Code:
    <?php
    $host
    ="localhost"// Host name
    $username="username"// Mysql username
    $password="password"// Mysql password
    $db_name="dbname"// Database name
    $tbl_name="tblname"// Table name

    // Connect to server and select database.
    mysql_connect("$host""$username""$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");

    // Get values from form
    $FullName=$_POST['FullName'];
    $MobileNumber=$_POST['Number'];
    $EmailAddress=$_POST['EmailAddress'];
    $Address=$_POST['Address'];
    $petathome=$_POST['petathome'];
    .
    PHP Code:
    [CODE]// Loop through the array of checked box values ...
    $pets="";
    $flag=0;
    foreach(
    $petathome as $entry){
    $pets .= $entry."|";
    $flag=1;
    }
    if(
    $flag==1){
    $pets=rtrim($pets);
    }[/
    CODE





    I am new to PHP and have a similar requirement. May i plz know why $flag and rtrim function is used here??

  4. #49
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do i insert multiple image and multiple values of check box

    i tried foreach() function an an error "Invalid argument supplied for foreach()" was displayed. i need some help, thank you

    heres my form:
    <form name="form" class="formtest" method="post" action="doPostUpcomingTrips.php" ENCTYPE="multipart/form-data">
    <fieldset>
    <label for="country_name">Name of Country:</label>
    <input type="text" name="country_name"/></br></br>

    <label for="country_city">City of Country:</label>
    <input type="text" name="country_city"/></br></br>

    <label for="course">Course:</label>
    <input type="checkbox" name="course" value="1"/>DBA
    <input type="checkbox" name="course" value="2"/>DBIS
    <input type="checkbox" name="course" value="3"/>DIT
    <input type="checkbox" name="course" value="4"/>DIDM
    <input type="checkbox" name="course" value="5"/>DISM
    <input type="checkbox" name="course" value="6"/>DMSD
    <br><br>

    <label for="date_of_departure">Date of Departure:</label>
    <input type="date" name="date_of_departure"/></br></br>

    <label for="date_of_return">Date of return:</label>
    <input type="date" name="date_of_return"/></br></br>

    <label for="date_of_closed_registration">Closed Registration Date:</label>
    <input type="date" name="date_of_closed_registration"/></br></br>

    <label for="description">Description:</label>
    <textarea wrap="virtual" name="description" rows=15 cols=50></textarea></br></br>

    <label for="imagesfile">Image1:</label>
    <input type="FILE" name="image1"/></br></br>

    <label for="imagesfile">Image2:</label>
    <input type="FILE" name="image2"/></br></br>

    <label for="imagesfile">Image3:</label>
    <input type="FILE" name="image3"/></br></br>

    <label for="submit"></label><input name="submit" value="Submit" type="submit">

    </fieldset>
    </form>





    and my insert portion:
    <!DOCTYPE>
    <html>
    <head>

    </head>
    <body>
    <table>

    </table>
    <table border="10" width="1001" align="center" cellspacing="0" >
    <?php
    session_start();
    $ID=$_SESSION['id'];

    $HOST = "localhost";
    $USERNAME = "root";
    $PASSWORD = "";
    $DB = "fyp";
    $link = mysqli_connect($HOST,$USERNAME,$PASSWORD,$DB) or die(mysqli_connect_error());

    $country_name= $_POST['country_name'];
    $country_city= $_POST['country_city'];
    $date_of_departure=$_POST['date_of_departure'];
    $date_of_return=$_POST['date_of_return'];
    $date_of_closed_registration=$_POST['date_of_closed_registration'];
    $description=$_POST['description'];
    $course=$_POST['course'];

    $soiCourse="";
    $flag=0;
    foreach($course as $entry){
    $soiCourse .= $entry.", ";
    $flag=1;
    }
    if($flag==1){
    $soiCourse=rtrim($soiCourse);
    }
    $soiCourse=mysql_real_escape_string($soiCourse);

    $query1 = "INSERT INTO trips(description,date_of_closed_registration,country_name,country_city,date_of_departure,date_of_re turn,course_name, staff_id)
    VALUES ('$description','$date_of_closed_registration','$country_name','$country_city','$date_of_departure', '$date_of_return','$soiCourse','$ID')";
    $result1= mysqli_query($link, $query1) or die('Error querying database');
    if ($result1) {
    echo "Article has been sucessfully uploaded,to view go <a href='index.php'>Home</a>";
    } else {
    echo" Article failed to be uploaded.<br> <a href='addArticle.php'>Try again/a>";
    }
    ?>




    </body>



    </html>

  5. #50
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,395
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    When you use an array, it must have square brackets ...

    <input type="checkbox" name="course[]" value="1"/>DBA

    Try that and you may find that it works.


 
Page 4 of 4 FirstFirst ... 234

Posting Permissions

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