473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

PHP trouble

Hi, I'm trying to use PHP to to a lot of repetetive work for me on a
site. I've gotten most of it working fine - EXCEPT:

the PHP is generating a table. It's looping through a CSV file until
it reaches the end. Each row is a product that one can buy. I'm
trying to make the last column of the table a customized paypal button
based on the current variables. To do this I've tried two different
things.

1. Break the php code and insert the HTML form (remember though,
this HTML break is inside a for loop) and use <?php [variable] ?to
insert the variables where I need them.

2. DON'T break the code and echo the form. and delimit the quotes.

I've isolated variables out of the problem...delimiting...everything.
it all works outside of the loop. Does php not work in a loop? I'll
post code for anyone intersted
Feb 3 '08 #1
2 1239
On Feb 3, 12:29 pm, AceX <AceIncorpora...@gmail.comwrote:
Hi, I'm trying to use PHP to to a lot of repetetive work for me on a
site. I've gotten most of it working fine - EXCEPT:

the PHP is generating a table. It's looping through a CSV file until
it reaches the end. Each row is a product that one can buy. I'm
trying to make the last column of the table a customized paypal button
based on the current variables. To do this I've tried two different
things.

1. Break the php code and insert the HTML form (remember though,
this HTML break is inside a for loop) and use <?php [variable] ?to
insert the variables where I need them.

2. DON'T break the code and echo the form. and delimit the quotes.

I've isolated variables out of the problem...delimiting...everything.
it all works outside of the loop. Does php not work in a loop? I'll
post code for anyone intersted
Post the code and we'll take a look.
Feb 3 '08 #2
AceX wrote:
[...] value="<?php $line[$c]? [...]

Is that right? Will it work?
No, that won't work. This will:

value="<?php echo $line[$c]; ?>"
Is there a better way?
I usually prefer to echo() the entire HTML, like as:

<?php
echo "<input type='hidden' name='amount' value='{$line[$c]}'>";
?>

It's a matter of coding style, anyway. It won't have any (noticeable) impact
on performance, but (arguably) may improve code readability.

In other words: stick with the conding style more comfortable for you.

(Related reading: http://en.wikipedia.org/wiki/Indent_style - there is
no "right" or "better" indent style also)

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Dos: Venerable. Windows: Vulnerable. OS/2: Viable.
Feb 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James | last post by:
Hi I am having some trouble getting a asp page to load. Im a noob to the asp side. I have followed knowledege base Article 301305. I am running 2000 adv, IIS 5.0 I have the following...
4
by: Jacek Dziedzic | last post by:
Hi! First of all, I hope my problem is not too loosely tied to the "standard C++" that is the topic of this group. I have some code that exhibits a strange behaviour: on one computer, where I...
0
by: Paul C | last post by:
Hello, everybody. I am having trouble running some of the VS.NET samples, specifically the CarSelector web app, which is very simple. The symptom is that the web controls (drop down listboxes and...
0
by: Alexandre Jaquet | last post by:
Hi does anybody know how to solve my trouble, when I try to create a MS Office project I always got trouble. I can't create office project when I try to create one vs.net restart ... :s
2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
1
by: Jim Bancroft | last post by:
Hi everyone, I'm running into a problem with my ASP.Net application. I've just created a new aspx page which uses some new components of mine that inherit from ServicedComponent and are...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
2
by: JLupear | last post by:
I am having trouble with my code again, I had prepared a question and the code to upload, however I am having trouble posting it, are there limits to the amount of lines you can post? I split it...
0
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.