Jump to content

Page is blank when loaded - is it the echoed table?


rawky1976

Recommended Posts

<?php

$user = $_GET['userid'];

include 'config.php';
include 'opendb.php';

$query = "select * from users WHERE user_id LIKE '$user'"; 

$result = mysql_db_query("servicemgmt", $query . mysql_error());

$r = mysql_fetch_array($result)

$firstname = $r['user_fname'];
$lastname = $r['user_lname'];
$ext = $r['user_ext'];
$bleep = $r['user_bleep'];
$exttel = $r['user_extno'];
$email = $r['user_email'];


echo "<table style="width: 80%">";
echo "<tr><td>First Name</td><td><input type=\"text\" value=\"$firstname\"\n name="firstname" id="firstname" style="width: 160px"/></td><td>Last Name</td><td> <input type=\"text\" value=\"$lastname\">\n name="lastname" id="lastname" style="width: 160px"/></td></tr>";
echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
echo "<tr><td>Extension</td><td> <input type=\"text\" value=\"$ext\">\n name="ext" id="ext" style="width: 160px"/></td><td>Bleep No.</td><td> <input type=\"text\" value=\"$bleep\">\n name="bleep" id="bleep" style="width: 160px"/></td></tr>";
echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
echo "<tr><td>External Tel.</td><td><input type=\"text\" value=\"$exttel\">\n name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>";
echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
echo "<tr><td>Email</td><td><input type=\"text\" value=\"$email\">\n name="email" id="email" style="width: 200px" /></td><td> </td><td> </td></tr>";
echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
echo "<tr><td><input name="updateuser" type="submit" id="updateuser" value="Update User Details" /></td><td> </td><td> </td><td><input name="reset1" type="reset" value="Clear Form" /></td></tr>";
echo "</table>";

?>

Link to comment
Share on other sites

1. please use code tags when posting code.

2. posting plain code and asking to fix it without any background or foreword is a little bit rude.  how do you think a doctor would feel if i just walked up to him, said not a damned word, and stuck my arm out to show him my hives?  he may help, but he'd probably also charge you money for it.  we don't get paid.

 

try explaining the problem, even if it seems trivial.  we aren't here to baby you.

Link to comment
Share on other sites

Sorry guys!

 

From the previous page is: <a href=\"editSearcheduser.php?userid=$id\">

 

When clicked this goes to the page in the code which should reload the Add User form but this time with the fields populated. Then you change what you want and submit it back?

 

Link to comment
Share on other sites

The problem is you have a lot of unescaped double quote. You can't place a double quote inside the string you are echoing wihtout escaping it with a backslash if you are using double quotes so surround the string. The reason why you get a blank page is because you have the display_errors directive set to off.

 

If you were to add:

 

error_reporting(E_ALL);
ini_set('display_errors','On');

 

To to top of your page, you would get some error messages. To fix, go through and escape all of the double quotes inside your string, or use single quotes to surround the attribtues of your html tags/your string.

 

Beaten to it - but thought id post anyways. Might add something with the explanation of display errors.

Link to comment
Share on other sites

@akitchin - lmga

 

i have no idea what lmga means.  all i could find was "Location Managers Guild of America" and "Louisiana Meat Goat Association."

 

Haha, i wasn't the only one to google. Even urbandictionary.com doesn't have any suggestions. I thought it had gotten to the stage where you could put any 3/4 letter combination in and someone had come up with a meaning

Link to comment
Share on other sites

<input type=\"text\" value=\"$exttel\">\n name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>

 

you're ending every input tag early, right after the value.  if you changed it to single quotes, it's because you're now escaping the ending double quote.  when HTML sees \" after a starting quote, it assumes you mean that double quote literally as opposed to meaning it as a delimiter.

 

if you're using single quotes, you can remove every backslash used to escape the double quotes.

Link to comment
Share on other sites

afr short for Afrikaans.

lmga directly translated: laugh my ass off(laugh out loud).

Will fix the wikipedia link.

 

rawky1976 try this:

<?php

$user = $_GET['userid'];

include 'config.php';
include 'opendb.php';

$query = "select * from users WHERE user_id LIKE '$user'"; 

$result = mysql_db_query("servicemgmt", $query . mysql_error());

$r = mysql_fetch_array($result);

$firstname = $r['user_fname'];
$lastname = $r['user_lname'];
$ext = $r['user_ext'];
$bleep = $r['user_bleep'];
$exttel = $r['user_extno'];
$email = $r['user_email'];


echo '<table style="width: 80%">';
echo '<tr><td>First Name</td><td><input type="text" value="$firstname" name="firstname" id="firstname" style="width: 160px "/></td><td>Last Name</td><td> <input type="text" value="$lastname" name="lastname" id="lastname" style="width: 160px" /></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Extension</td><td> <input type="text" value="$ext" name="ext" id="ext" style="width: 160px" /></td><td>Bleep No.</td><td> <input type="text" value="$bleep" name="bleep" id="bleep" style="width: 160px"/></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>External Tel.</td><td><input type="text" value="$exttel" name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Email</td><td><input type="text" value="$email" name="email" id="email" style="width: 200px" /></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td><input name="updateuser" type="submit" id="updateuser" value="Update User Details" /></td><td> </td><td> </td><td><input name="reset1" type="reset" value="Clear Form" /></td></tr>';
echo '</table>';

?>

Link to comment
Share on other sites

for example

 

echo "so he said to her.."get in bed now, I want some action," whilst stripping off!"

 

is wrong as the echo statement looks for the " to start the statment and the next " to stop.

 

Clearly this would result in a very strange output.

 

SO

 

we can do this

 

echo "so he said to her..\"get in bed now, I want some action,\" whilst stripping off!"

 

which 'escapes' the " or we can do this

 

echo 'so he said to her.."get in bed now, I want some action," whilst stripping off!'.

 

Hope that makes sense to you

Link to comment
Share on other sites

for example

 

echo "so he said to her.."get in bed now, I want some action," whilst stripping off!"

 

is wrong as the echo statement looks for the " to start the statment and the next " to stop.

 

Clearly this would result in a very strange output.

 

SO

 

we can do this

 

echo "so he said to her..\"get in bed now, I want some action,\" whilst stripping off!"

 

which 'escapes' the " or we can do this

 

echo 'so he said to her.."get in bed now, I want some action," whilst stripping off!'.

 

Hope that makes sense to you

 

.. followed by "not tonight honey, 'i have a headache.'"

Link to comment
Share on other sites

NArc0t1c:

 

It'll need to be this:

 

<?php

$user = $_GET['userid'];

include 'config.php';
include 'opendb.php';

$query = "select * from users WHERE user_id LIKE '$user'"; 

$result = mysql_db_query("servicemgmt", $query . mysql_error());

$r = mysql_fetch_array($result)

$firstname = $r['user_fname'];
$lastname = $r['user_lname'];
$ext = $r['user_ext'];
$bleep = $r['user_bleep'];
$exttel = $r['user_extno'];
$email = $r['user_email'];


echo '<table style="width: 80%">';
echo '<tr><td>First Name</td><td><input type="text" value="'.$firstname.'" name="firstname" id="firstname" style="width: 160px "/></td><td>Last Name</td><td> <input type="text" value="'.$lastname.'" name="lastname" id="lastname" style="width: 160px" /></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Extension</td><td> <input type="text" value="'.$ext.'" name="ext" id="ext" style="width: 160px" /></td><td>Bleep No.</td><td> <input type="text" value="'.$bleep.'" name="bleep" id="bleep" style="width: 160px"/></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>External Tel.</td><td><input type="text" value="'.$exttel.'" name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Email</td><td><input type="text" value="'.$email.'" name="email" id="email" style="width: 200px" /></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td><input name="updateuser" type="submit" id="updateuser" value="Update User Details" /></td><td> </td><td> </td><td><input name="reset1" type="reset" value="Clear Form" /></td></tr>';
echo '</table>';

?>

 

Otherwise your variables wont get evaluated.

Link to comment
Share on other sites

Now I am confused, I have this which is still blank:

 

<?php

error_reporting(E_ALL);
ini_set('display_errors','1');

$user = $_GET['userid'];

include 'config.php';
include 'opendb.php';

$query = "select * from users WHERE user_id LIKE '$user'"; 

$result = mysql_db_query("servicemgmt", $query . mysql_error());

$r = mysql_fetch_array($result)

$firstname = $r['user_fname'];
$lastname = $r['user_lname'];
$ext = $r['user_ext'];
$bleep = $r['user_bleep'];
$exttel = $r['user_extno'];
$email = $r['user_email'];


//echo "<table style=\"width: 80%\">";
//echo "<tr><td>First Name</td><td><input type=\"text\" value=\"$firstname\"\n name=\"firstname\" id=\"firstname\" style=\"width: 160px\"/></td><td>Last Name</td><td> <input type=\"text\" value=\"$lastname\">\n name=\"lastname\" id=\"lastname\" style=\"width: 160px\"/></td></tr>";
//echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
//echo "<tr><td>Extension</td><td> <input type=\"text\" value=\"$ext\">\n name=\"ext\" id=\"ext\" style=\"width: 160px\"/></td><td>Bleep No.</td><td> <input type=\"text\" value=\"$bleep\">\n name=\"bleep\" id=\"bleep\" style=\"width: 160px\"/></td></tr>";
//echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
//echo "<tr><td>External Tel.</td><td><input type=\"text\" value=\"$exttel\">\n name=\"exttel\" id=\"exttel\" style=\"width: 160px\"/></td><td> </td><td> </td></tr>";
//echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
//echo "<tr><td>Email</td><td><input type=\"text\" value=\"$email\">\n name=\"email\" id=\"email\" style=\"width: 200px\" /></td><td> </td><td> </td></tr>";
//echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>";
//echo "<tr><td><input name=\"updateuser\" type=\"submit\" id=\"updateuser\" value=\"Update User Details\" /></td><td> </td><td> </td><td><input name=\"reset1\" type=\"reset\" value=\"Clear Form\" /></td></tr>";
//echo "</table>";

//echo '<table style="width: 80%">';
//echo '<tr><td>First Name</td><td><input type="text" value="'.$firstname.'" name="firstname" id="firstname" style="width: 160px "/></td><td>Last Name</td><td> <input type="text" value="'.$lastname.'" name="lastname" id="lastname" style="width: 160px" /></td></tr>';
//echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
//echo '<tr><td>Extension</td><td> <input type="text" value="'.$ext.'" name="ext" id="ext" style="width: 160px" /></td><td>Bleep No.</td><td> <input type="text" value="'.$bleep.'" name="bleep" id="bleep" style="width: 160px"/></td></tr>';
//echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
//echo '<tr><td>External Tel.</td><td><input type="text" value="'.$exttel.'" name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>';
//echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
//echo '<tr><td>Email</td><td><input type="text" value="'.$email.'" name="email" id="email" style="width: 200px" /></td><td> </td><td> </td></tr>';
//echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
//echo '<tr><td><input name="updateuser" type="submit" id="updateuser" value="Update User Details" /></td><td> </td><td> </td><td><input name="reset1" type="reset" value="Clear Form" /></td></tr>';
//echo '</table>';	

echo '<table style="width: 80%">';
echo '<tr><td>First Name</td><td><input type="text" value="$firstname" name="firstname" id="firstname" style="width: 160px "/></td><td>Last Name</td><td> <input type="text" value="$lastname" name="lastname" id="lastname" style="width: 160px" /></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Extension</td><td> <input type="text" value="$ext" name="ext" id="ext" style="width: 160px" /></td><td>Bleep No.</td><td> <input type="text" value="$bleep" name="bleep" id="bleep" style="width: 160px"/></td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>External Tel.</td><td><input type="text" value="$exttel" name="exttel" id="exttel" style="width: 160px"/></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td>Email</td><td><input type="text" value="$email" name="email" id="email" style="width: 200px" /></td><td> </td><td> </td></tr>';
echo '<tr><td> </td><td> </td><td> </td><td> </td></tr>';
echo '<tr><td><input name="updateuser" type="submit" id="updateuser" value="Update User Details" /></td><td> </td><td> </td><td><input name="reset1" type="reset" value="Clear Form" /></td></tr>';
echo '</table>';
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.