Solved

How to create move next action in php forms

Posted on 2011-03-06
2
257 Views
Last Modified: 2012-05-11
I am using the following php codes to pass data from a database to a html form. It works fine but I can't move through the records

The form code is
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<BODY>
<?php
include '../Script/singledataview.php';

echo '<form action="singledataview.php" >';
echo 'ID: <input type="text" value="' . $id . '"><br>';
echo 'Title: <input type="text" value="' . $title . '"><br>';
echo 'Body: <input type="text" value="' . $body . '"><br>';
echo '<INPUT TYPE="button" NAME="Next" VALUE="Next">';
echo '</form>';

?>

</BODY>
</HTML>

Open in new window


singledataview.php
 
<?php
include '../Script/mysqlConnect.php';

$TableName="`notes`";	

include '../Script/tabledata.php';

$num= mysql_numrows($result);

$i=$i++;

echo 'charlie '. $i;
$id= mysql_result($result,$i,"id");
$title=mysql_result($result,$i,"title");
$body=mysql_result($result,$i,"body");

$i=$i++;
include '../Script/mysqlDisconnect.php';
	
?>

Open in new window


tabledata.php
 
<?php

$sql = "select * from " . $TableName;
echo $sql;

$result = mysql_query($sql,$con)

?>

Open in new window

0
Comment
Question by:Sheils
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
psimation earned 500 total points
ID: 35045738
I'm not sure I can figure out what it is you are trying to do here?

Are you trying to populate a Form from data already in a mysql table?

To create loops, you have a couple of options:
1. while loops
2. for loops
3. foreach loops

You can look up examples of each on www.php.net 


0
 
LVL 16

Author Comment

by:Sheils
ID: 35047111
psimation,

Yes I am trying to populate the form with data already in a mysql table. I know about the looping technics but I don't think it will work in this instance. My understanding it that looping dumps all the records from the table or query in a datasheet. I want to display one record at a time and use a next button to display the following record.

I have the trial record on http://www.wowislandcharter.com/DBScratch/managementstystem/forms/Page2.php.

I have used loop on the main page and that's fine. What I am after is a solution for Page2 where I want to move through the records one by one.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question