Results 1 to 2 of 2

Thread: Submitting data

  1. #1
    Join Date
    Feb 2002
    Posts
    43

    Unanswered: Submitting data

    I have a page that displays a list of items:

    Item 1 ..... ...... ......
    Item 2 ..... ..... .....
    Item 3 .... .... .....
    .
    .
    .
    Item N ... .... .....

    I want to be able to make Item Item 2, etc... a hyperlink where if the user clicks it will send the name Item 1 to a page that displays infomation on that item. Can anyone help me with this code. I have tried the following, but keep getting a null error.

    echo ("<TR><TD><form action=\"info.php\" method=\"post\"><input type=\"hidden\" value=\"$ID\" name=\"Type\"><a href=\"\" onclick=\"this.form.submit();\">$ID</a></form></TD><TD>other info</TD><TD>other info</TD><TD align=\"center\">other info</TD><TD>other info</TD></TR>");

    Can anyone tell me what I am doing wrong.

  2. #2
    Join Date
    Oct 2003
    Posts
    63

    Re: Submitting data

    Originally posted by cmptrguru7
    I have a page that displays a list of items:

    Item 1 ..... ...... ......
    Item 2 ..... ..... .....
    Item 3 .... .... .....
    .
    .
    .
    Item N ... .... .....

    I want to be able to make Item Item 2, etc... a hyperlink where if the user clicks it will send the name Item 1 to a page that displays infomation on that item. Can anyone help me with this code. I have tried the following, but keep getting a null error.

    echo ("<TR><TD><form action=\"info.php\" method=\"post\"><input type=\"hidden\" value=\"$ID\" name=\"Type\"><a href=\"\" onclick=\"this.form.submit();\">$ID</a></form></TD><TD>other info</TD><TD>other info</TD><TD align=\"center\">other info</TD><TD>other info</TD></TR>");

    Can anyone tell me what I am doing wrong.
    Hello!

    I think you've better to look at templating systems like FastTemplate http://www.thewebmasters.net/php/FastTemplate.phtml , Yapter http://yapter.sourceforge.net/ , phpOBTemplate http://www.e-taller.net/dev/obtemplate/ or something like that (there are a lot of them in the web, but IMHO all I pointed more comfortable ). These tools will give you a possibility to separate the PHP code from the HTML. So, you will control all site logic more full.

    Using FastTemplate you will have separated HTML like this:

    <TR><TD><form action="{script_name}" method="post"><input type="hidden" value="{ID}" name="Type"><a href="onclick="this.form.submit();"">{ID}</a></form></TD>
    <TD>other info</TD>
    <TD>other info</TD>
    <TD align="cente">other info</TD>
    <TD>other info</TD></TR>

    Note your values are replaced with some variables between braces. PHP templating class will perform data, HTML template and all variables between braces will be replaced with real values.

    I hope you understand me, sorry my poor English.

Posting Permissions

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