NYCPHP Meetup

NYPHP.org

[nycphp-talk] Having problems with PHP or maybe something bigger...

Anthony Wlodarski aw at sap8.com
Tue Jul 24 14:58:10 EDT 2007


Tom,

Definitely can, I re broke it and the HTML is as follows from IE's source
function.  Now I also noticed that I had a top most nested <form></form>
tags that were not correct so I fixed them all but this is the HTML output
from the non working version.  I wonder if a top level <form></form> tag
will corrupt any other similar tags below it.

<html>

<head>
<title>
Form
</title>
</head>

<body style='font-family: arial;'>

<form action='/Anthony/dev/names.php' method='post'>
<fieldset><legend>Add a company</legend>
Company Name: 
<input type='text' name='companyname'>
 Company Color: 
<select name='color'>
<option value='ff0000'>red</option>
<option value='ff9933'>orange</option>
<option value='ffff33'>yellow</option>
<option value='00ee00'>green</option>
<option value='0000ff'>blue</option>
<option value='9966ff'>indigo</option>
<option value='990099'>violet</option>
<option value='ffffff'>white</option>
</select>
<input type='submit' name='addcompany' value='Add company.'>
</fieldset>
<form>
<form action='/Anthony/dev/names.php' method='post'>
<fieldset><legend>Add a manager</legend>
Hiring Manager: 
<input type='text' name='manager'>
 Company: 
<select name='companyid'>
<option value='1'>About.com</option><option
value='2'>Feedroom</option><option value='3'>Mizuho</option></select>
 Position Title: 
<input type='text' name='position'>
 Recruiter Initials 
<input type='text' name='recruiter'>
<input type='submit' name='addmanager' value='Add manager.'>
</fieldset><form>
<form action='/Anthony/dev/names.php' method='post'>
<fieldset><legend>Add a candidate</legend>
Candidate: 
<input type='text' name='name'>
 Status: 
<input type='text' name='status'>
 Hiring Manager: 
<select name='managerid'>
<option value='1'>David Midgett</option><option value='2'>Steven
Gittleson</option></select>
<input type='submit' name='addcandidate' value='Add candidate.'>
</fieldset>
<form>
<table style='padding: 0px; font-family: arial;'><tr style='border: solid
2px black; background-color: #000000; color: #ffffff;'><td style='border:
solid 2px black; width: 100px;'></td><td style='border: solid 2px black;
width: 300px; text-align: center;'>Company Name</td><td style='border: solid
2px black; width: 300px;'></td><td style='border: solid 2px black; width:
100px;'></td><tr>
<tr style='border: solid 2px black; background-color: ff0000'>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'>About.com</td>
<td style='border: solid 2px black; width: 300px;'></td>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='1'>
<input type='hidden' name='database' value='company'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: '>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'>David Midgett</td>
<td style='border: solid 2px black; width: 300px;'>Sr. Systems
Administrator</td>
<td style='border: solid 2px black; width: 100px;'>AW</td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='1'>
<input type='hidden' name='database' value='manager'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: '>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'></td>
<td style='border: solid 2px black; width: 300px;'>Normain Wai</td>
<td style='border: solid 2px black; width: 100px;'>Hired</td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='1'>
<input type='hidden' name='database' value='candidate'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: '>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'></td>
<td style='border: solid 2px black; width: 300px;'>Matthew</td>
<td style='border: solid 2px black; width: 100px;'>Landolf</td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='2'>
<input type='hidden' name='database' value='candidate'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: 0000ff'>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'>Feedroom</td>
<td style='border: solid 2px black; width: 300px;'></td>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='2'>
<input type='hidden' name='database' value='company'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: '>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'>Steven Gittleson</td>
<td style='border: solid 2px black; width: 300px;'>Front End Web
Developer</td>
<td style='border: solid 2px black; width: 100px;'>AW</td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='2'>
<input type='hidden' name='database' value='manager'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
<tr style='border: solid 2px black; background-color: ff9933'>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 300px;'>Mizuho</td>
<td style='border: solid 2px black; width: 300px;'></td>
<td style='border: solid 2px black; width: 100px;'></td>
<td style='border: solid 2px black; width: 100px; text-align: center;'>
<form action='./edit.php' method='post'>
<input type='hidden' name='id' value='3'>
<input type='hidden' name='database' value='company'>
<input type='submit' name='edit' value='Edit'>
<form>
</td>
</tr>
</table>

</body>
</html>



Anthony Wlodarski
Technical Recruiter
Shulman Fleming & Partners
646-285-0500 x230
aw at sap8.com

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Tom Sartain
Sent: Tuesday, July 24, 2007 12:24 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Having problems with PHP or maybe something
bigger...

Could you provide the HTML from the initial setup (the one that was broken)?
I'm curious about what was output to the browser (since that's what dictates
where the form is sent anyway)

Thanks
On 7/24/07, Anthony Wlodarski <aw at sap8.com> wrote:
Donald,

Thanks for the recommendation, I tried it and it did not work.  I even
looked up one level to the function that calls this function and I couldn't
trace back and incorrect code.  I moved the code out of the function and put

it in its own php file:

<?php

                echo "<form action='./edit.php' method='post'>\n";
                echo "<input type='hidden' name='id' 
value='".$row['id']."'>\n";
                echo "<input type='hidden' name='database'
value='candidate'>\n";
                echo "<input type='submit' name='edit' value='Edit'>\n"; 
                echo "<form>\n";

?>

Results: It pointed to edit.php.  This is weird and mind blowing as well.

Anthony Wlodarski
Technical Recruiter
Shulman Fleming & Partners 
646-285-0500 x230
aw at sap8.com

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto: talk-bounces at lists.nyphp.org] On
Behalf Of Donald Organ
Sent: Tuesday, July 24, 2007 11:15 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Having problems with PHP or maybe something
bigger...

try turning 
        echo "<form action='./edit.php' method='post'>\n";
into
        echo "<form action='/edit.php' method='post'>\n";

On Tue, 2007-07-24 at 11:08 -0400, Anthony Wlodarski wrote: 
> Hello all,
>
> I am currently contracted by my boss to create a candide/company tracking
system in PHP/MySQL and have hit a little snag.
>
> Here is the code:
>
> function displayCandidates($managerid) 
> {
>       $sqlcandidates = "SELECT * FROM `candidate` WHERE `managerid` =
".$managerid."";
>       $resultcandidates = mysql_query($sqlcandidates) or die('Error, get
candidates query failed'); 
>
>       while($row = mysql_fetch_array($resultcandidates, MYSQL_ASSOC))
>       {
>               echo "<tr style='border: solid 2px black; background-color:
".$row['color']."'>\n"; 
>               echo "<td style='border: solid 2px black; width:
100px;'></td>\n";
>               echo "<td style='border: solid 2px black; width:
300px;'></td>\n"; 
>               echo "<td style='border: solid 2px black; width:
300px;'>".$row['name']."</td>\n";
>               echo "<td style='border: solid 2px black; width: 
100px;'>".$row['status']."</td>\n";
>               // add a edit button
>               echo "<td style='border: solid 2px black; width: 100px;
text-align: center;'>\n"; 
>               echo "<form action='./edit.php' method='post'>\n";
>               echo "<input type='hidden' name='id'
value='".$row['id']."'>\n"; 
>               echo "<input type='hidden' name='database'
value='candidate'>\n";
>               echo "<input type='submit' name='edit' value='Edit'>\n"; 
>               echo "<form>\n";
>               echo "</td>\n";
>               echo "</tr>\n";
>       }
> }
>
> Now that code would create a button at the end of the table row that 
should call the php file "edit.php" however when I go to the webpage the
button links to "names.php" which is the name of the file that contains this
code.  I do have references to $_SERVER['PHP_SELF'] in the code in other 
places to call the script itself if certain buttons are pressed but I don't
see how that could have interfered.  It is blowing my mind because I thought
it would be a simple thing to fix but I can't figure it out.  I even moved 
the form echo statements to a test file on the server and it does not do
this at all.
> -Anthony W.
> Technical Recruiter
> Shulman Fleming & Partners
> aw at sap8.com 
> 646 285 0500 x230
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk 
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk 

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php 



_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php 






More information about the talk mailing list