Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create move next action in php forms

Posted on 2011-03-06
2
Medium Priority
?
269 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

610 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